/* Содействие Кабинет — оформление. Шрифт системный: на Windows это Segoe UI. */
:root {
  --bg: #f4f6f9; --surface: #ffffff; --surface-2: #f8fafc; --border: #e4e8ee; --border-strong: #cfd6df;
  --text: #17202b; --text-2: #4a5768; --muted: #7b8796;
  --accent: #2f5bea; --accent-soft: #eaf0ff; --accent-dark: #2147c7;
  --nav: #111a2e; --nav-2: #1b2640; --nav-text: #b9c3d6;
  --red: #e03e3e; --red-soft: #fdeeee; --orange: #ef7d16; --orange-soft: #fff1e4;
  --yellow: #e2a900; --yellow-soft: #fff8dc; --blue: #3d9be9; --blue-soft: #e8f4fd;
  --green: #2a9d5c; --green-soft: #e6f6ed; --gray-soft: #eef1f5;
  --radius: 10px; --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .12);
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 24px; line-height: 1.25; margin: 0; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 14px; margin: 16px 0 8px; font-weight: 600; color: var(--text-2); }
code { background: var(--gray-soft); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }
.icon { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); font-size: 12.5px; }

/* --- Каркас ---------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex: none; background: var(--nav); color: var(--nav-text); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; padding: 18px 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; padding: 4px 8px 18px; text-decoration: none !important; }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; background: linear-gradient(135deg, #4f7dff, #2f5bea);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; letter-spacing: .02em; flex: none; }
.brand-text { font-weight: 600; font-size: 14px; line-height: 1.2; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px; color: var(--nav-text);
  font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--nav-2); color: #fff; }
.nav a.active { background: var(--accent); color: #fff; }
.nav-section { text-transform: uppercase; font-size: 11px; letter-spacing: .08em; color: #6c7891; padding: 18px 12px 6px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid #22304d; margin-top: 12px; }
.sidebar-user .who { flex: 1; display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.sidebar-user strong { color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user span { font-size: 12px; }
.sidebar-user form { margin: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #2b3a5c; color: #fff; display: grid; place-items: center;
  font-weight: 600; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; background: var(--accent-soft); color: var(--accent); }
.icon-btn { background: none; border: 0; color: inherit; padding: 6px; border-radius: 6px; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: var(--nav-2); color: #fff; }
.main-area { flex: 1; min-width: 0; }
.content { padding: 28px 32px 60px; max-width: 1440px; }
.mobilebar { display: none; }

/* --- Заголовки страниц ----------------------------------------------------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-head.sticky { position: sticky; top: 0; background: var(--bg); padding: 12px 0; z-index: 5; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.head-actions form { margin: 0; }

/* --- Кнопки и поля --------------------------------------------------------- */
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text); font: 500 14px var(--font); text-decoration: none !important; white-space: nowrap; transition: background .12s, border-color .12s; }
button:hover, .button:hover { background: var(--surface-2); border-color: #b5bfcc; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover, .button.primary:hover { background: var(--accent-dark); }
button.danger, .button.danger { background: var(--surface); border-color: #f1b5b5; color: var(--red); }
button.danger:hover { background: var(--red-soft); }
button.ghost, .button.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
button.ghost:hover { background: var(--gray-soft); }
button.small, .button.small { height: 28px; padding: 0 10px; font-size: 12.5px; }
button.wide { width: 100%; height: 42px; font-size: 15px; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { height: 36px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font: 14px var(--font); color: var(--text); background: var(--surface); max-width: 100%; }
textarea { height: auto; padding: 8px 11px; }
input[type=file] { height: auto; padding: 6px; }
input[type=checkbox] { height: 16px; width: 16px; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input.date { width: 124px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span, .field > label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.field input, .field select, .field textarea { width: 100%; }
.field.has-error input, .field.has-error select { border-color: var(--red); }
.field .help { font-size: 12px; color: var(--muted); }
.error { color: var(--red); font-size: 12.5px; } .warn { color: #a66a00; font-size: 12.5px; } .ok { color: var(--green); font-weight: 500; }
.errorlist { list-style: none; margin: 0; padding: 0; color: var(--red); font-size: 12.5px; }

/* --- Карточки и сетки ------------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px;
  margin-bottom: 18px; box-shadow: var(--shadow); scroll-margin-top: 70px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 16px 20px 0; }
.columns { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }

/* --- Таблицы --------------------------------------------------------------- */
.grid { width: 100%; border-collapse: separate; border-spacing: 0; }
.grid th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.grid td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover td { background: #fafbfd; }
.grid.small td { padding: 8px 12px; font-size: 13px; } .grid.small th { padding: 8px 12px; }
.grid .num { color: var(--muted); font-variant-numeric: tabular-nums; width: 56px; }
.grid a.name { font-weight: 600; color: var(--text); }
.grid a.name:hover { color: var(--accent); }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow); }
tr.closed td { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 28px !important; }
.kv { width: 100%; border-collapse: collapse; }
.kv th { text-align: left; font-weight: 400; color: var(--muted); padding: 7px 16px 7px 0; width: 45%; vertical-align: top; font-size: 13px; }
.kv td { padding: 7px 0; font-weight: 500; }
.kv td.q-cell { width: 28px; text-align: right; }
.kv tr + tr th, .kv tr + tr td { border-top: 1px dashed var(--border); }

/* --- Статусы, бейджи ------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; background: var(--gray-soft); color: var(--text-2);
  border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.badge .variant-source { opacity: .72; font-weight: 400; }
.badge.red { background: var(--red-soft); color: var(--red); } .badge.orange { background: var(--orange-soft); color: #b65a06; }
.badge.yellow { background: var(--yellow-soft); color: #8a6700; } .badge.blue { background: var(--blue-soft); color: #1e6fb3; }
.badge.green { background: var(--green-soft); color: var(--green); } .badge.accent { background: var(--accent-soft); color: var(--accent); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #c3cad4; flex: none; }
.dot.red { background: var(--red); } .dot.orange { background: var(--orange); } .dot.yellow { background: var(--yellow); }
.dot.blue { background: var(--blue); } .dot.green { background: var(--green); }
.deadline { display: inline-flex; align-items: center; gap: 7px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.red { background: var(--red-soft); color: var(--red); } .pill.orange { background: var(--orange-soft); color: #b65a06; }
.pill.yellow { background: var(--yellow-soft); color: #8a6700; } .pill.blue { background: var(--blue-soft); color: #1e6fb3; }
.pill.green { background: var(--green-soft); color: var(--green); } .pill.none { background: var(--gray-soft); color: var(--muted); }
.q { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 11px; font-weight: 700; cursor: help; }
.q-confirmed { background: var(--green-soft); color: var(--green); } .q-check { background: var(--orange-soft); color: var(--orange); }
.q-missing { background: var(--red-soft); color: var(--red); }
.quality-action { position: relative; display: inline-block; }
.quality-action summary { list-style: none; cursor: pointer; }
.quality-action summary::-webkit-details-marker { display: none; }
.quality-action form { position: absolute; z-index: 5; right: 0; top: 27px; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); white-space: nowrap; }

/* --- Уведомления ----------------------------------------------------------- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid; }
.alert .icon { margin-top: 1px; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.alert.warning { background: var(--yellow-soft); border-color: #f2df9c; color: #6b5100; }
.alert.danger { background: var(--red-soft); border-color: #f3c1c1; color: #8f2424; }
.alert.info { background: var(--accent-soft); border-color: #c9d7ff; color: #23408f; }
.toasts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.toast { padding: 11px 16px; border-radius: var(--radius-sm); background: var(--accent-soft); color: #23408f; border: 1px solid #c9d7ff; font-weight: 500; }
.toast.success { background: var(--green-soft); color: #1d6b40; border-color: #b7e2c8; }
.toast.error { background: var(--red-soft); color: #8f2424; border-color: #f3c1c1; }
.toast.warning { background: var(--yellow-soft); color: #6b5100; border-color: #f2df9c; }

/* --- Фильтры --------------------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 18px; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 500; color: var(--text-2); }
.filters label.check { flex-direction: row; align-items: center; height: 36px; gap: 8px; font-size: 14px; }
.filters select { min-width: 150px; }
.search-box { position: relative; flex: 1 1 360px; max-width: 520px; }
.search-box .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { width: 100%; height: 42px; padding-left: 40px; font-size: 15px; border-radius: var(--radius); }

/* --- Рабочий экран --------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
  position: relative; overflow: hidden; color: var(--text); text-decoration: none !important; display: block; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--border-strong); }
.kpi.red::before { background: var(--red); } .kpi.orange::before { background: var(--orange); }
.kpi.yellow::before { background: var(--yellow); } .kpi.blue::before { background: var(--blue); }
.kpi .label { color: var(--text-2); font-weight: 500; font-size: 13px; }
.kpi .value { font-size: 32px; font-weight: 700; line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi.red .value { color: var(--red); }
.kpi:hover { box-shadow: var(--shadow-lg); }
.queues { display: grid; grid-template-columns: repeat(auto-fill, minmax(520px, 1fr)); gap: 16px; }
.queue { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; scroll-margin-top: 20px; }
.queue summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 14px 18px; font-weight: 600; }
.queue summary::-webkit-details-marker { display: none; }
.queue summary .left { display: flex; align-items: center; gap: 10px; }
.queue summary .chev { transition: transform .15s; color: var(--muted); }
.queue[open] summary .chev { transform: rotate(90deg); }
.queue[open] summary { border-bottom: 1px solid var(--border); }
.queue .count { min-width: 28px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--gray-soft); color: var(--text-2);
  display: inline-grid; place-items: center; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.queue.red .count { background: var(--red-soft); color: var(--red); } .queue.orange .count { background: var(--orange-soft); color: #b65a06; }
.queue.yellow .count { background: var(--yellow-soft); color: #8a6700; } .queue.blue .count { background: var(--blue-soft); color: #1e6fb3; }
.queue.is-empty summary { color: var(--muted); font-weight: 500; }
.queue-list { max-height: 360px; overflow-y: auto; }
.queue-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center;
  padding: 10px 18px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none !important; }
.queue-row:last-child { border-bottom: 0; }
.queue-row:hover { background: #fafbfd; }
.queue-row .body { display: flex; flex-direction: column; min-width: 0; }
.queue-row .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-row .w { color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-row .r { color: var(--muted); }
.queue-empty { padding: 14px 18px; color: var(--muted); }
.notice-list { list-style: none; margin: 0; padding: 0; }
.notice-list li { padding: 8px 0; border-bottom: 1px solid #d6e1ff; }
.notice-list li:last-child { border: 0; }

/* --- Карточка работника ---------------------------------------------------- */
.profile { display: flex; gap: 18px; align-items: flex-start; }
.profile h1 { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.profile .number { font-size: 14px; font-weight: 600; color: var(--muted); background: var(--gray-soft); padding: 2px 8px; border-radius: 6px; }
.profile .latin { color: var(--muted); margin-top: 2px; letter-spacing: .02em; }
.worker-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 24px; align-items: start; }
.toc { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 2px; }
.toc a { padding: 7px 12px; border-radius: 7px; color: var(--text-2); font-weight: 500; display: flex; justify-content: space-between; text-decoration: none !important; }
.toc a:hover { background: var(--surface); color: var(--text); }
.toc .n { color: var(--muted); font-size: 12px; }
.doc-history { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 10px; }
.doc-history summary { cursor: pointer; color: var(--text-2); font-weight: 500; }
.history-doc { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 14px; margin-top: 10px; }
.sub { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.inline { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; padding: 12px; background: var(--surface-2);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.inline-form.plain { background: none; border: 0; padding: 0; }
.inline-form .compact-field { display: flex; flex-direction: column; gap: 4px; color: var(--text-2); font-size: 12px; font-weight: 500; }
.inline-form .compact-field input, .inline-form .compact-field select { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.action-group { padding: 14px 0; border-bottom: 1px solid var(--border); }
.action-group:first-of-type { padding-top: 0; }
.action-group:last-child { border-bottom: 0; padding-bottom: 0; }
.action-group h3 { margin-top: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr); gap: 20px; align-items: start; }
.scan-pane { position: sticky; top: 20px; height: calc(100vh - 60px); background: #2a3242; border-radius: var(--radius); display: flex;
  align-items: center; justify-content: center; overflow: auto; color: #aeb7c6; text-align: center; padding: 20px; }
.scan-pane img { max-width: 100%; border-radius: 4px; } .scan-pane iframe { width: 100%; height: 100%; border: 0; background: #fff; border-radius: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px 20px; }
.form-grid.narrow { grid-template-columns: 1fr; }
.form-actions { display: flex; gap: 12px; align-items: center; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.form-actions .left { margin-right: auto; }

/* --- Шаблоны документов --------------------------------------------------- */
.template-search { display: flex; gap: 8px; margin-bottom: 18px; }
.template-search input { width: min(520px, 100%); }
.template-list { display: grid; gap: 8px; }
.template-item { display: flex; align-items: center; gap: 16px; padding: 15px 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); text-decoration: none !important; }
.template-item:hover { border-color: var(--accent); background: var(--surface-2); }
.template-item-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.template-item-main strong { font-size: 15px; }
.template-item-status, .template-version-actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.template-arrow { color: var(--muted); font-size: 20px; }
.template-detail-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.template-version-actions { margin-bottom: 14px; }
.template-detail-page { max-width: 1000px; }
.template-version-actions .template-file-link { align-self: center; margin-left: 8px; font-size: 13px; }
.template-version-meta { margin-bottom: 0; }
.template-disclosure > summary { cursor: pointer; font-size: 17px; font-weight: 600; }
.template-disclosure-body { padding-top: 16px; }
.template-disclosure-body > p:first-child { margin-top: 0; }
.template-history-links { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }
.template-extra-section { margin: 18px 0; padding: 18px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.template-extra-section h3 { margin-top: 0; }
.template-extra-section .stack { max-width: 620px; }
.template-extra-section .stack label.template-check { flex-direction: row; align-items: center; font-size: 14px; font-weight: 400; }
.template-retire-form { margin-top: 14px; }
.template-inline-details { margin-top: 14px; }
.template-inline-details > summary { cursor: pointer; }
.template-activate-files { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.template-activate-files .card { min-width: 0; }
.template-activate-files h2 { margin-top: 0; }
.template-activate-files a + a { margin-left: 10px; }
.template-visual-compare > summary { cursor: pointer; font-size: 16px; font-weight: 600; }
.template-preview-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.template-preview-pair iframe { width: 100%; height: min(70vh, 850px); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.template-activate-confirm { margin-top: 18px; }
.template-activate-confirm > label { display: flex; flex-direction: column; gap: 6px; max-width: 620px; margin: 12px 0; }
.template-activate-confirm > label.template-check { flex-direction: row; align-items: center; }
.template-activate-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
@media (max-width: 700px) { .template-activate-files, .template-preview-pair { grid-template-columns: 1fr; } }
.template-history-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.template-history-row:last-child { border: 0; }
.template-text-preview { white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.55 var(--font); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; max-height: 480px; overflow: auto; }
.template-markers { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 0; }
.template-fields { max-height: 400px; overflow: auto; margin-top: 12px; }
.template-fields > div { display: flex; gap: 10px; align-items: baseline; padding: 5px 0; border-bottom: 1px solid var(--border); }
.template-fields span { font-size: 12.5px; color: var(--text-2); }
.template-form { max-width: 820px; }
.template-form input[type=checkbox] { width: auto; }
.template-document-preview { max-width: 900px; font: 16px/1.55 Georgia, "Times New Roman", serif; }
.template-document-preview p { margin: 0 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.template-document-preview .table-wrap { margin: 14px 0; }
.template-document-preview td { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 60px; }
.template-cell-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 8px 20px; }
.template-cell-list > div { display: flex; align-items: baseline; gap: 12px; border-bottom: 1px solid var(--border); padding: 6px 0; }
.template-cell-list code { min-width: 54px; text-align: center; }
.template-cell-list span { overflow-wrap: anywhere; }
.template-editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.template-editor-main { min-width: 0; }
.template-editor-toolbar { display: flex; gap: 7px; margin-bottom: 10px; }
.template-editor-toolbar button { min-width: 96px; }
.template-live-diff { margin: 16px 0 20px; }
.template-live-diff[hidden] { display: none; }
.template-live-diff .template-diff-wrap { max-height: 480px; overflow: auto; }
.template-editor-numbered { position: relative; }
.template-editor-numbered textarea { padding-left: 64px; }
.template-line-gutter { position: absolute; z-index: 1; top: 1px; bottom: 5px; left: 1px; width: 52px; padding-top: 8px; overflow: hidden; pointer-events: none; background: var(--surface-2); border-right: 1px solid var(--border); border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.template-line-gutter span { display: block; padding-right: 9px; box-sizing: border-box; }
.template-line-mirror { position: absolute; left: -10000px; top: 0; visibility: hidden; pointer-events: none; white-space: pre-wrap; overflow-wrap: break-word; }
.template-line-mirror div { min-height: 1lh; }
.template-editor-main textarea { width: 100%; min-height: 480px; resize: vertical; line-height: 1.55; }
.template-editor-main .field + .field { margin-top: 16px; }
.template-draft-bar { display: flex; gap: 12px; align-items: center; justify-content: space-between; min-height: 34px; margin: 8px 0 14px; }
.template-draft-bar button[hidden] { display: none; }
.template-field-picker { position: sticky; top: 20px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.template-field-picker h2 { margin-bottom: 2px; }
.template-field-picker p { margin: 0 0 12px; }
.template-field-picker > input { width: 100%; }
.template-field-groups { max-height: 440px; overflow: auto; margin-top: 12px; }
.template-field-group { border-top: 1px solid var(--border); padding: 6px 0; }
.template-field-group summary { cursor: pointer; font-weight: 600; color: var(--text-2); }
.template-field-group > div { display: flex; flex-wrap: wrap; gap: 6px; padding: 9px 0; }
.template-insert-field { height: auto; min-height: 28px; padding: 4px 9px; font-size: 12.5px; white-space: normal; text-align: left; background: #fff; }
.template-insert-field[hidden], .template-field-group[hidden] { display: none; }
@media (max-width: 950px) { .template-editor-layout { grid-template-columns: 1fr; } .template-field-picker { position: static; } }
.template-compare-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.template-compare-controls label { display: flex; flex-direction: column; gap: 5px; color: var(--text-2); font-size: 12.5px; }
.template-compare-controls select { min-width: 220px; }
.template-compare-summary { display: flex; gap: 20px; align-items: center; margin: 6px 0 12px; font-weight: 600; }
.template-compare-summary label { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
.template-diff-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.template-diff { min-width: 760px; }
.template-diff-heading { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border-strong); background: var(--surface-2); font-weight: 600; }
.template-diff-heading span { padding: 10px 16px; }
.template-diff-heading span + span { border-left: 1px solid var(--border-strong); }
.template-diff-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) 42px minmax(0, 1fr); font: 12.5px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; border-bottom: 1px solid #edf0f4; }
.template-diff-row:last-child { border-bottom: 0; }
.template-diff-row .diff-number { padding: 5px 6px; color: var(--muted); text-align: right; user-select: none; background: #f8fafc; }
.template-diff-row .diff-content { padding: 5px 10px; white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.template-diff-row .diff-new { border-left: 1px solid var(--border); }
.template-diff-row .diff-new { position: relative; }
.template-diff-row .diff-new:has(.template-diff-revert) { padding-right: 42px; }
.template-diff-revert { position: absolute; right: 6px; top: 4px; width: 28px; height: 28px; padding: 0;
  border-radius: 5px; background: var(--surface); color: var(--text-2); font: 20px/1 var(--font); }
.template-diff-revert:hover, .template-diff-revert:focus-visible { color: var(--red); border-color: var(--red); }
.template-diff-row.delete .diff-old, .template-diff-row.replace .diff-old { background: #fff0f0; }
.template-diff-row.insert .diff-new, .template-diff-row.replace .diff-new { background: #eaf8ee; }
.template-diff-row .diff-old mark { background: #ffc9c9; color: inherit; }
.template-diff-row .diff-new mark { background: #b7ebc8; color: inherit; }
.template-diff.only-changes .template-diff-row.equal { display: none; }
@media (max-width: 900px) { .template-detail-grid { grid-template-columns: 1fr; } }

/* --- Карточка подачи ------------------------------------------------------- */
.progress { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 16px; box-shadow: var(--shadow); min-width: 260px; }
.progress .bar { flex: 1; height: 8px; background: var(--gray-soft); border-radius: 999px; overflow: hidden; }
.progress .bar > div { height: 100%; background: var(--green); transition: width .2s; }
.copy-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.copy-row { display: grid; grid-template-columns: 280px minmax(0, 1fr) 130px; gap: 16px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.copy-row:last-child { border-bottom: 0; }
.copy-row .label { color: var(--muted); font-size: 13px; }
.copy-row .value { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; word-break: break-word; }
.copy-row.copied { background: var(--surface-2); }
.copy-row.copied .value, .copy-row.copied .label { color: #a5afbd; }
.copy-row.missing { background: var(--yellow-soft); }
.copy-row button { justify-self: end; width: 120px; }
.copy-row.copied button { background: var(--green-soft); border-color: #b7e2c8; color: var(--green); }
.copy-row-actions, .copy-inline-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.copy-row-actions[hidden] { display: none; }
.copy-row-actions button, .copy-inline-actions button { width: auto; justify-self: auto; }
.copy-row-actions button[hidden] { display: none; }
.copy-inline-input { width: 100%; min-width: 120px; }
.copy-row .copy-edit, .copy-row .copy-reset { font-size: 12px; }

/* --- Календарь ------------------------------------------------------------- */
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-bottom: 18px; }
.month { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.month h3 { margin: 0 0 8px; color: var(--text); }
.month table { width: 100%; text-align: center; border-collapse: separate; border-spacing: 2px; font-variant-numeric: tabular-nums; }
.month th { font-size: 11px; color: var(--muted); font-weight: 500; }
.month td { height: 30px; border-radius: 6px; user-select: none; font-size: 13px; }
.month td:hover { background: var(--accent-soft); }
.month td.off { background: var(--red-soft); color: var(--red); font-weight: 600; }
.month td.changed { box-shadow: inset 0 0 0 2px var(--accent); }
.month td.out { cursor: default; background: none; }
.month .calendar-day { display: block; width: 100%; height: 30px; min-width: 30px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; }
.month .calendar-day:hover { background: transparent; border: 0; }
.month .calendar-day:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.legend { display: flex; gap: 16px; align-items: center; color: var(--text-2); font-size: 13px; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 6px; }

/* --- Вход ------------------------------------------------------------------ */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 20% -10%, #dfe7ff 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #e2f1ff 0%, transparent 55%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 16px; padding: 36px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.login-card form { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.login-card .brand { color: var(--text); padding: 0; }
.login-card .brand-text { font-size: 18px; }
.small-print { display: flex; gap: 8px; align-items: center; margin: 20px 0 0; }
.small-print .icon { width: 16px; height: 16px; }

/* --- Прочее ---------------------------------------------------------------- */
.pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; padding: 12px 0; color: var(--muted); }
.batch-selection-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 12px 0; color: var(--text-2); }
.batch-selection-bar.has-error { color: var(--red); outline: 2px solid var(--red); outline-offset: 3px; }
.danger-zone { margin-top: 20px; padding: 16px; border: 1px solid #f3c1c1; border-radius: var(--radius); background: var(--red-soft); }
.big-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.big-list a { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); font-weight: 600; font-size: 15px; text-decoration: none !important; }
.big-list a:hover { border-color: var(--accent); color: var(--accent); }
details > summary { cursor: pointer; }
.printable { background: #fff; padding: 32px; border-radius: var(--radius); }

@media (max-width: 1100px) {
  .columns, .split, .worker-layout { grid-template-columns: 1fr; }
  .toc { position: static; flex-direction: row; flex-wrap: wrap; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .queues { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr; }
  .scan-pane { position: static; height: 60vh; }
}
@media (max-width: 780px) {
  .sidebar { position: fixed; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .mobilebar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--nav); color: #fff; font-weight: 600; }
  .content { padding: 18px 16px 40px; }
  .copy-row { grid-template-columns: 1fr; gap: 4px; }
  .copy-row button { justify-self: start; }
}
@media print { .sidebar, .mobilebar, button, .toc { display: none !important; } .content { padding: 0; } }

/* Список работников: поиск во всю ширину, имена в одну строку */
.filters .search-box { flex: 1 1 100%; max-width: none; }
.grid a.name { white-space: nowrap; }
.grid td .muted { white-space: nowrap; }
.history-table { table-layout: fixed; }
.history-table td { vertical-align: top; overflow-wrap: anywhere; }
.history-table td .muted, .history-table td div { white-space: normal; overflow-wrap: anywhere; }
.worker-layout > div, .columns > *, .split > * { min-width: 0; }
@media (max-width: 1100px) {
  .toc { flex-wrap: nowrap; overflow-x: auto; }
  .toc a { white-space: nowrap; }
  .card { overflow-x: auto; }
}

/* Всплывающее окно ошибок формы */
.error-dialog { border: 0; border-radius: 14px; padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); color: var(--text); }
.error-dialog::backdrop { background: rgba(17, 26, 46, .45); }
.error-dialog-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 8px; font-size: 16px; }
.error-dialog-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--red-soft); color: var(--red); display: grid; place-items: center; font-weight: 700; }
.error-dialog-list { margin: 0; padding: 4px 22px 4px 62px; color: var(--text-2); }
.error-dialog-list li { margin: 6px 0; }
.error-dialog-actions { display: flex; justify-content: flex-end; padding: 14px 22px 20px; }

/* Руководство */
.guide-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.guide-list { list-style: none; padding: 0; margin: 0; }
.guide-list li { padding: 9px 0; border-top: 1px solid var(--border); }
.guide-list li:first-child { border-top: 0; }
.guide-list a { font-weight: 600; }
.guide-hit { padding: 10px 0; border-top: 1px solid var(--border); }
.guide-hit:first-of-type { border-top: 0; }
.guide-article { line-height: 1.65; font-size: 15px; max-width: 860px; }
.guide-article h2 { font-size: 19px; margin: 28px 0 10px; scroll-margin-top: 20px; }
.guide-article h2:first-child { margin-top: 0; }
.guide-article h3 { font-size: 15px; color: var(--text); margin: 18px 0 6px; }
.guide-article ol, .guide-article ul { padding-left: 22px; }
.guide-article li { margin: 4px 0; }
.guide-article table { border-collapse: collapse; margin: 10px 0; }
.guide-article th, .guide-article td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.guide-article th { background: var(--surface-2); }
.guide-article blockquote { margin: 12px 0; padding: 10px 14px; background: var(--accent-soft); border-left: 4px solid var(--accent); border-radius: 6px; }
.guide-article blockquote p { margin: 0; }
.help-link { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); font-weight: 700; font-size: 13px; text-decoration: none !important; vertical-align: middle; margin-left: 6px; }
.help-link:hover { background: var(--accent); color: #fff; }
.template-official-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(360px,1fr);gap:1.25rem;align-items:start}
.official-search-bar{display:flex;justify-content:space-between;align-items:center;gap:.75rem;margin:.75rem 0}
.official-search-actions{display:flex;gap:.5rem;flex-wrap:wrap}
.official-fragments{max-height:55vh;overflow:auto;margin:1rem 0;padding-right:.4rem}
.official-fragment{margin-bottom:.6rem;border:1px solid var(--border);border-radius:.5rem;padding:.7rem}
.official-fragment summary{cursor:pointer;line-height:1.4}
.official-fragment summary .muted{display:block;font-size:.8rem;margin-top:.25rem}
.official-fragment label{display:block;margin-top:.8rem}
.official-fragment textarea{display:block;width:100%;min-height:5rem;margin-top:.25rem}
.official-fragment[hidden]{display:none}
.official-preview{position:sticky;top:1rem}
.official-page-frame{height:70vh;overflow:auto;border:1px solid #d9e0ea;border-radius:.5rem;background:#e9edf3;text-align:center}
.official-page{display:block;width:100%;height:auto;background:white}
.official-page[hidden]{display:none}
.official-page-nav{display:flex;justify-content:space-between;margin:.7rem 0}
@media(max-width:900px){.template-official-layout{grid-template-columns:1fr}.official-preview{position:static}}
