/* Фирменный стиль Viamedis (как в «Программе годового совещания»):
   Montserrat, красный #AC0000, графит #231F20, серый #7F7F7F, светлые фоновые формы «V».
   Палитра графиков — фирменные цвета, проверена валидатором dataviz. Тема только светлая (решение 27.10.2026). */
:root {
  color-scheme: light;
  --brand: #ac0000; --ink: #231f20;
  --bg: #f4f4f4; --surface: #ffffff; --surface-2: #f2f2f2; --border: #e3e3e3;
  --text: #231f20; --text-2: #4d4b4c; --muted: #7f7f7f;
  --accent: #ac0000; --accent-hover: #8c0000; --accent-soft: #f7e6e6; --input: #fdf3e9;
  --th-bg: #ac0000; --th-text: #ffffff;
  --chip-active: #231f20; --chip-active-text: #ffffff;
  --shape: #e9e9e9;
  --s1: #3d46b0; --s2: #ac0000; --s3: #0f9a8f; --s4: #f68620;
  --s5: #8a4fa8; --s6: #3f8f2f; --s7: #8e9093; --s8: #e34948;
  --div-pos: #3d46b0; --div-neg: #ac0000;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --grid: #ececec;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text); min-height: 100vh;
  font: 14px/1.5 "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
/* фоновые формы «V», как на страницах фирменных документов */
body::before {
  content: ""; position: fixed; right: -60px; bottom: -80px; width: 560px; height: 720px; z-index: 0;
  pointer-events: none; background: var(--shape);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 560 720'%3E%3Cpath d='M0 0h250c18 150-2 330-70 520C120 390 50 210 0 0z'/%3E%3Cpath d='M560 70c-10 250-90 470-210 650h-90c70-200 170-430 300-650z'/%3E%3C/svg%3E") no-repeat center / contain;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 560 720'%3E%3Cpath d='M0 0h250c18 150-2 330-70 520C120 390 50 210 0 0z'/%3E%3Cpath d='M560 70c-10 250-90 470-210 650h-90c70-200 170-430 300-650z'/%3E%3C/svg%3E") no-repeat center / contain;
}
main, .top { position: relative; }
h3 { margin: 0; font-size: 13.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--accent); }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap;
  padding: 10px 22px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.logo-img { height: 30px; width: auto; display: block; flex: none; }
.title { font-weight: 600; }
.modules { display: flex; gap: 2px; background: var(--surface-2); border-radius: 8px; padding: 3px; width: max-content;
  max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.modules::-webkit-scrollbar { display: none; }
.modules a { white-space: nowrap; }
.modules a { padding: 4px 12px; border-radius: 6px; font-weight: 600; font-size: 12.5px; color: var(--text-2); text-decoration: none; }
.modules a:hover { color: var(--text); }
.modules a.active { background: var(--chip-active); color: var(--chip-active-text); }
tr.grp td { background: var(--surface-2); }
.sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
/* вкладки — отдельной строкой во всю ширину: строка «Данные по …» длинная, рядом им тесно */
nav { display: flex; gap: 2px; order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-bottom: -10px; }
nav::-webkit-scrollbar { display: none; }
nav button {
  border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-2); font: inherit;
  font-weight: 600; font-size: 13px; padding: 8px 12px; cursor: pointer;
}
nav button:hover { color: var(--text); }
nav button.active { color: var(--accent); border-bottom-color: var(--accent); }
.actions { display: flex; gap: 6px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; border: 1px solid var(--accent); background: var(--accent);
  color: #fff; padding: 7px 14px; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: none; color: var(--text); border-color: var(--border); font-weight: 500; }
.btn.ghost:hover { border-color: var(--text-2); background: none; }
.btn.small { padding: 3px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }

main { padding: 18px 22px 44px; max-width: 1600px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.kpi .l { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi .v { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.alert .v { color: var(--accent); }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.grid2 .card { margin-bottom: 0; }
.card.wide { grid-column: 1 / -1; }
.card-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.card p.small { margin: 0 0 8px; }
.chart { position: relative; height: 300px; }
.chart.tall { height: 320px; }
.link { font-size: 12.5px; text-decoration: none; font-weight: 600; }

.signals { display: flex; flex-direction: column; gap: 6px; }
.sig {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  background: var(--surface-2); cursor: pointer; border: 0; font: inherit; color: var(--text); text-align: left;
}
.sig:hover { outline: 1px solid var(--border); }
.sig .ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; flex: none; }
.sig .n { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
input[type=search], select, input[type=text], input[type=number], input[type=password], input[type=date], input:not([type]), textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=search] { min-width: 260px; }
.chk { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }

.tablewrap { overflow: auto; max-height: 70vh; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.card .tablewrap { max-height: 420px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th {
  position: sticky; top: 0; background: var(--th-bg); color: var(--th-text); font-weight: 600;
  font-size: 12px; cursor: pointer; white-space: nowrap; z-index: 1; border-bottom: 0;
}
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
tr.total td { font-weight: 700; background: var(--surface-2); }
tr.clickable { cursor: pointer; }
tr.detail td { background: var(--bg); padding: 10px 14px; }
td.input { background: var(--input); }
td:first-child { white-space: nowrap; }
td.input input { width: 90px; text-align: right; border-color: transparent; background: transparent; }
td.input input:focus { border-color: var(--accent); background: var(--surface); }
.wrap { min-width: 260px; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.b-crit { color: var(--critical); }
.b-warn { color: #b07a00; }
.b-ser { color: #c45a2e; }
.b-good { color: var(--good); }
.b-mute { color: var(--muted); }

.drop {
  display: grid; place-items: center; min-height: 120px; border: 2px dashed var(--border);
  border-radius: 10px; cursor: pointer; color: var(--text-2); margin: 10px 0; text-align: center; padding: 16px;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input { display: none; }
.res { padding: 8px 10px; border-radius: 6px; margin-top: 6px; font-size: 13px; background: var(--surface-2); }
.res.ok { border-left: 3px solid var(--good); }
.res.err { border-left: 3px solid var(--critical); }

.q { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.q .h { display: flex; gap: 10px; align-items: baseline; }
.q textarea { width: 100%; min-height: 54px; margin-top: 8px; resize: vertical; }

.kpi.click { cursor: pointer; transition: border-color .15s; }
.kpi.click:hover, .kpi.click:focus-visible { border-color: var(--accent); outline: none; }
.kpi .more { font-size: 11.5px; color: var(--accent); margin-top: 6px; }
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .45); display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; width: min(1100px, 100%);
  max-height: calc(100vh - 32px); overflow: auto; padding: 16px 18px; }
.modal-box .kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 10px 0 12px; }
.modal-box .kpi .v { font-size: 19px; }
.modal-box .tablewrap { max-height: none; }
.modal-box td.wrap { min-width: 200px; max-width: 360px; white-space: normal; }
.modal-box th, .modal-box td { padding: 6px 8px; }
.pbar { position: relative; height: 4px; width: 96px; margin: 4px 0 0 auto; background: var(--surface-2); border-radius: 2px; }
.pbar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: currentColor; }
.pbar::after { content: ""; position: absolute; left: 66.67%; top: -3px; bottom: -3px; width: 1px; background: var(--text-2); }
.pbar.nomark::after { display: none; }
.chart canvas { cursor: default; }
.md h4 { margin: 18px 0 6px; font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.md .kpis { margin: 12px 0 4px; }
.md-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: 12.5px;
  padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--chip-active); border-color: var(--chip-active); color: var(--chip-active-text); font-weight: 600; }
.chip.nofact:not(.active) { color: var(--muted); border-style: dashed; }
.legend-inline { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.legend-inline .sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-left: 8px; }
.legend-inline .sw:first-child { margin-left: 0; }
@media (max-width: 900px) { .md-grid { grid-template-columns: minmax(0, 1fr); } }

.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.settings fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 10px; margin: 0 0 12px; min-width: 0; }
.settings fieldset.wide, .settings .actions-row { grid-column: 1 / -1; }
.settings legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
.settings label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.settings label.chk { flex-wrap: nowrap; align-items: flex-start; }
.settings label.chk input { margin-top: 3px; flex: none; }
.settings .cats { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 4px; }
.settings .cats label { margin: 2px 0; font-size: 12.5px; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.diff { margin-top: 12px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.diff table td:nth-child(2), .diff table td:nth-child(3) { text-align: right; font-variant-numeric: tabular-nums; }
td.input input[type=date] { width: 140px; text-align: left; }
@media (max-width: 900px) { .settings { grid-template-columns: minmax(0, 1fr); } }

.delta { font-weight: 600; white-space: nowrap; }
.kpi .v .vtxt { display: block; font-size: 15px; font-weight: 600; line-height: 1.3; margin-top: 3px; }
.delta.up { color: var(--good); }
.delta.down { color: var(--critical); }
.dash-sec { margin-bottom: 12px; }
.chip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: 1px; }
tr.sel td { background: var(--accent-soft); }

.heat td.hc { text-align: center; font-variant-numeric: tabular-nums; cursor: pointer; min-width: 58px; font-size: 12px; }
.heat td.hc:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.heat td.hc.na { cursor: default; color: var(--muted); }
.heat td.hc.na:hover { outline: none; }

#toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface);
  padding: 8px 14px; border-radius: 8px; font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none;
}
#toast.show { opacity: 1; }

.hint { cursor: pointer; text-decoration: underline dotted; }

.brand { flex: 1; }
.brand > div { min-width: 0; }
.brand .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
nav button { white-space: nowrap; }
@media (max-width: 1250px) { .top { gap: 8px 16px; } }
@media (max-width: 900px) {
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  main { padding: 12px 16px 32px; }
  .top { padding: 10px 16px; }
  input[type=search] { min-width: 0; width: 100%; }
}
@media (max-width: 600px) {
  .brand { flex-wrap: wrap; gap: 8px 16px; }
  .brand > div { flex: 1 1 100%; min-width: 0; }
  .brand .sub { white-space: normal; }
  .modules { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .modules a { padding: 4px 7px; font-size: 12px; white-space: nowrap; }
  .actions { flex-wrap: wrap; max-width: 100%; }
}

/* окно детализации: заголовок — обычным регистром, крупнее */
.modal-box h3 { text-transform: none; letter-spacing: 0; font-size: 16px; color: var(--text); }
.modal-box { border-radius: 14px; }
.chip { border-radius: 8px; font-weight: 500; }
.settings legend { color: var(--accent); text-transform: uppercase; font-size: 12px; letter-spacing: .04em; }
.q { border-radius: 12px; }
.drop { border-radius: 12px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- модуль «Фин план» ---------- */
.pace-line { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 10px;
  padding: 9px 14px; margin-bottom: 12px; font-size: 13px; color: var(--text-2); }
.notice { border-radius: 10px; padding: 11px 14px; margin-bottom: 12px; font-size: 13px; line-height: 1.5;
  background: var(--accent-soft); border-left: 4px solid var(--accent); }
.notice.warn { background: var(--input); border-left-color: var(--s4); }
.notes { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-2); }
.notes li { margin: 5px 0; line-height: 1.5; }
.legend-inline .line-sw { width: 14px; height: 0; border-top: 2px dashed var(--text-2); border-radius: 0; }
.neg { color: var(--div-neg); }
.pos { color: var(--good); }
tr.total.grand td { border-top: 2px solid var(--text-2); }
tr.sub-total td { background: var(--surface-2); }
tr.muted-row td { color: var(--muted); }
.indent { padding-left: 14px; display: inline-block; }
input.num-in { width: 130px; text-align: right; padding: 5px 8px; }
.checklist { max-height: 300px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; margin-top: 8px; }
.checklist.tall { max-height: 520px; }
.checklist label { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 110px; gap: 4px 10px; align-items: start;
  padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer; }
.checklist label:last-child { border-bottom: 0; }
.checklist label.on { background: var(--accent-soft); }
.checklist label input { margin-top: 3px; }
.checklist .num { text-align: right; white-space: nowrap; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 0 6px; border-radius: 4px; background: var(--input); color: #b05a00;
  vertical-align: 1px; text-transform: none; letter-spacing: 0; }
.tag.warn { background: var(--accent-soft); color: var(--accent); }
.mt { margin-top: 14px; }
.plan-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.add-dept { margin-top: 10px; }
.plan-ext { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 8px; }
.plan-ext label { flex-direction: column; align-items: flex-start; font-size: 12.5px; color: var(--text-2); }
.modal-box h4 { margin: 14px 0 6px; font-size: 13px; }
#drillTable .tablewrap { max-height: 300px; }
.card .tablewrap.sheet { max-height: none; }
.tablewrap.sheet td:first-child { min-width: 260px; white-space: normal; }
.tablewrap.sheet th { white-space: normal; }
.settings.rules { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 6px 0; }
.settings.rules label { flex-direction: column; align-items: stretch; font-size: 12.5px; color: var(--text-2); }
.settings.rules textarea { font: inherit; font-size: 13px; resize: vertical; }
.mo-details { margin-top: 6px; }
.mo-details summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 8px; }
td.unused input { opacity: .45; }
.ds-price-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 8px; }
.ds-price-row label { display: flex; align-items: center; gap: 6px; }
.ds-price-row input.num-in { width: 120px; }

/* таблицы «как лист книги» */
.book-card { margin-bottom: 16px; }
table.book th.c { text-align: center; }
table.book thead tr:first-child th { border-bottom: 1px solid rgba(255, 255, 255, .25); }
table.book td.fin { font-weight: 700; text-align: center; vertical-align: middle; background: var(--surface-2); width: 96px; font-size: 12.5px; }
table.book tr.main td.nm { font-weight: 600; }
table.book tr.sub-row td { font-size: 12.5px; color: var(--text-2); padding-top: 4px; padding-bottom: 4px; }
table.book tr.sub-row td.nm { padding-left: 24px; }
table.book tr.vol td { font-style: italic; }
table.book tr.grp td:first-child { font-weight: 700; }
table.book tbody tr:hover td.fin { background: var(--surface-2); }
.sec-h { margin: 22px 0 12px; }

/* ---------- модуль «Экспертиза» ---------- */
.xlayout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 18px; align-items: start; }
.xside { position: sticky; top: 118px; max-height: calc(100vh - 136px); overflow: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; padding: 8px; }
.xgrp { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); padding: 12px 8px 4px; }
.xitem { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; border: 0; background: none; font: inherit;
  font-size: 13px; color: var(--text-2); text-align: left; padding: 6px 8px; border-radius: 8px; cursor: pointer; line-height: 1.3; }
.xitem:hover { background: var(--surface-2); color: var(--text); }
.xitem.active { background: var(--chip-active); color: var(--chip-active-text); font-weight: 600; }
.xn { font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; padding: 1px 7px; border-radius: 999px; flex: none; }
.xn.bad { background: var(--accent-soft); color: var(--accent); }
.xn.ok { background: rgba(12, 163, 12, .12); color: var(--good); }
.xn.rev { background: var(--surface-2); color: var(--text-2); }
.xn.none { color: var(--muted); }
.xitem.active .xn { background: rgba(255, 255, 255, .18); color: inherit; }
.xhead h2 { margin: 0 0 4px; font-size: 20px; font-weight: 700; color: var(--text); }
.xhead p { margin: 0 0 14px; font-size: 13px; max-width: 980px; }
.xtiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.xtile { text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border);
  border-radius: 12px; padding: 12px 14px; cursor: pointer; transition: border-color .15s; }
.xtile:hover, .xtile:focus-visible { border-color: var(--accent); outline: none; }
.xtile.bad { border-left-color: var(--accent); }
.xtile.ok { border-left-color: var(--good); }
.xtile.rev { border-left-color: var(--s1); }
.xtile.off { opacity: .7; border-left-style: dashed; }
.xtile .t { font-size: 12.5px; font-weight: 600; color: var(--text-2); line-height: 1.35; min-height: 34px; }
.xtile .v { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.xtile.bad .v { color: var(--accent); }
.xtile .v .u { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.xtile .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.xfilters .grow { flex: 1; }
.xdims { margin-bottom: 16px; }
.xdims .tablewrap { max-height: 330px; }
.xdims td.wrap { min-width: 180px; max-width: 420px; white-space: normal; }
.chart.short { height: 260px; }
.xrows { max-height: 72vh; }
.card .tablewrap.xrows { max-height: 72vh; }
.xrows td.wrap { min-width: 200px; max-width: 460px; white-space: normal; }
.xrows td { font-size: 12.5px; }
.more-row { text-align: center; margin-top: 10px; }
.pk { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.th-sub { font-weight: 400; font-size: 10.5px; opacity: .85; white-space: normal; max-width: 150px; margin-left: auto; }
.pivot td.pv { cursor: pointer; }
.pivot td.pv:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.wide-in { width: 100%; font: inherit; }
.card .tablewrap#stdTable, .card .tablewrap#coverTable { max-height: none; }
textarea.wide-in { resize: vertical; }
.btn.copy { margin-left: 4px; padding: 0 6px; font-size: 11px; }
@media (max-width: 900px) {
  .xlayout { grid-template-columns: minmax(0, 1fr); }
  .xside { position: static; max-height: 46vh; }
}

a.pt { color: var(--text); text-decoration: none; border-bottom: 1px dotted var(--muted); white-space: nowrap; }
a.pt:hover { color: var(--accent); border-bottom-color: var(--accent); }
.doctab td.dc { cursor: pointer; }
.doctab td.dc:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
.doctab:not(.all) tr.more { display: none; }
.card .tablewrap.doctab { max-height: none; }
.doctab th.num { white-space: normal; min-width: 64px; font-size: 11px; line-height: 1.25; vertical-align: bottom; }
.modal-box.wide { width: min(1400px, 100%); }
.modal-box .tablewrap { margin-bottom: 4px; }
.xfilters input[type=date] { padding: 5px 8px; }

/* ---------- модуль «Скрининг» ---------- */
.scards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.scard { text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; cursor: pointer; transition: border-color .15s; }
.scard:hover, .scard:focus-visible { border-color: var(--accent); outline: none; }
.scard .t { font-size: 13px; color: var(--text-2); line-height: 1.35; }
.scard .t b { color: var(--accent); margin-right: 4px; }
.scard .m { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.scard .v { font-size: 24px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.scard .v .u { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.scard .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.scard .s b { color: var(--text); }
.sbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface-2); margin: 8px 0 6px; }
.sbar i { display: block; height: 100%; }
.s-done { background: var(--good); } .s-eps { background: var(--s3); } .s-proc { background: var(--warning); }
.s-none { background: var(--s7); } .s-bad { background: var(--critical); }
.sb { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; color: #fff; margin: 1px 0; white-space: nowrap; }
.sb.s-none { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.sb.s-proc { color: #3a2a00; }
.sb.s-excl { background: none; color: var(--muted); border: 1px dashed var(--border); text-decoration: line-through; }
.sb.s-carry { background: none; color: var(--s1); border: 1px solid var(--s1); }
td.nw { white-space: nowrap; }
td.ac { cursor: pointer; }
td.ac:hover { outline: 2px solid var(--accent); outline-offset: -2px; }
#areaTable td:first-child { min-width: 150px; }

/* ---------- общая загрузка ---------- */
.uptargets { margin: 4px 0 0; padding-left: 18px; font-size: 12.5px; }
.uptargets li { margin: 2px 0; }
.uptargets li.ok::marker { content: "✓  "; color: var(--good); }
.uptargets li.skip { color: var(--muted); }
.uptargets li.skip::marker { content: "—  "; }
.uptargets li.err { color: var(--critical); }
.uptargets li.err::marker { content: "✕  "; }
.upnote { font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.mods { display: flex; flex-wrap: wrap; gap: 4px; }
.mods span { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }

/* ---------- филиалы ---------- */
.branch-sel { font-weight: 600; border-color: var(--accent); }
.branch-file { margin: 6px 0 0; }
.fin-all th.bh { text-align: center; border-left: 1px solid rgba(255, 255, 255, .25); }
.fin-all td.bl { border-left: 1px solid var(--border); }
.fin-all tr.total td { font-weight: 700; }
#allView { display: none; }
#labEmpty { display: none; }
#dash.no-data > #labEmpty { display: block; }
#dash.no-data > :not(#labEmpty) { display: none !important; }
#fdash.all-mode > #allView { display: block; }
#fdash.all-mode > :not(#allView) { display: none !important; }
.fin-all td.nm { white-space: normal; min-width: 220px; }

/* ---------- личный кабинет ---------- */
.btn.ghost.active { border-color: var(--accent); color: var(--accent); }
.acc-head { display: flex; align-items: center; gap: 16px; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center;
          justify-content: center; font-size: 20px; font-weight: 700; letter-spacing: .02em; flex: none; }
.acc-who h2 { margin: 0 0 6px; font-size: 20px; }
.acc-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.acc-form { display: grid; gap: 10px; max-width: 460px; margin: 10px 0 12px; }
.acc-form label:not(.chk), .acc-field { display: grid; gap: 4px; font-size: 12.5px; color: var(--text-2); }
.acc-form input:not([type=checkbox]), .acc-form select { width: 100%; box-sizing: border-box; font-size: 14px; color: var(--text); }
.acc-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 8px 0 12px; font-size: 13.5px; }
.acc-dl dt { color: var(--text-2); }
.acc-dl dd { margin: 0; }
input.uname { width: 100%; min-width: 180px; box-sizing: border-box; }
@media (max-width: 640px) { .acc-dl { grid-template-columns: 1fr; gap: 2px; } .acc-dl dd { margin-bottom: 6px; } }

/* ---------- доступ к модулям ---------- */
.modules a[hidden] { display: none; }
.mod-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; max-width: 360px; }
.mod-chip { font-size: 11.5px; padding: 1px 7px; border-radius: 10px; border: 1px solid var(--border); white-space: nowrap; color: var(--text-2); }
.mod-chip.edit { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.mods-all { margin-bottom: 4px; white-space: nowrap; }
.mods-box { width: min(560px, 100%); }
.mods-matrix { width: 100%; margin: 8px 0; }
.mods-matrix th, .mods-matrix td { text-align: center; vertical-align: middle; padding: 5px 8px; }
.mods-matrix th { position: static; cursor: default; }
.mods-matrix th:first-child, .mods-matrix td:first-child { text-align: left; padding-left: 10px; }
.mods-matrix td:first-child { font-weight: 500; }
.mods-matrix tbody tr:hover td { background: var(--surface-2); }
.mods-radio { display: inline-flex; padding: 4px 12px; cursor: pointer; }
.mods-radio input { width: 16px; height: 16px; margin: 0; cursor: pointer; }
.mods-na { color: var(--text-2); }
.mods-presets { margin: 4px 0 10px; }
.mods-actions { margin: 8px 0 0; }
#newMods { max-width: 560px; margin-top: 6px; }
.rule-chk { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; font-size: 13.5px; }
/* выбор филиалов пользователя (кабинет → Пользователи) */
.brpick { position: relative; display: inline-block; }
.brpick > summary { list-style: none; cursor: pointer; padding: 5px 26px 5px 9px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); font-size: 13px; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; position: relative; }
.brpick > summary::-webkit-details-marker { display: none; }
.brpick > summary::after { content: "▾"; position: absolute; right: 9px; color: var(--muted); }
.brpick-pop { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 220px; padding: 8px 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .12); }
.brpick-pop label { display: flex; gap: 8px; align-items: center; margin: 4px 0; font-size: 13.5px; white-space: nowrap; }
.brpick-pop p { margin: 6px 0 0; white-space: normal; }
