/* Аренда БЦ - стили интерфейса в фирменном стиле ГК «Возрождение» (брендбук: серый Pantone 431C, красный Pantone 200C,
   шрифты Century Gothic и Book Antiqua Bold). Цвета - токены; тёмная тема - свои значения, а не инверсия. */
:root {
  color-scheme: light;
  /* фирменные цвета (как в файле логотипа) */
  --brand-red: #cc1543;
  --brand-red-ink: #a3102f;
  --brand-gray: #677279;
  --brand-gray-dark: #454e54;
  --bg: #f1f2f3;
  --surface: #ffffff;
  --surface-2: #f7f8f8;
  --surface-3: #eceeef;
  --ink: #262c30;
  --ink-2: #4c555b;
  --ink-3: #59656c;
  --head: #4f5a61;
  --line: #dfe2e4;
  --line-2: #c6cbce;
  --accent: var(--brand-red);
  --accent-hover: #a3102f;
  --accent-ink: #ffffff;
  --accent-soft: #fbe8ed;
  --link: #315f88;
  --vacant: #3d7fc4;
  --side: #ffffff;
  --side-ink: #4c555b;
  --side-active: #fbe8ed;
  /* статусы (фиксированные, не для серий) */
  --good: #0ca30c;      --good-soft: #e3f4e3;   --good-ink: #075f07;
  --warning: #fab219;   --warning-soft: #fdf1d5; --warning-ink: #7a5200;
  --serious: #ec835a;   --serious-soft: #fbe7de; --serious-ink: #8a3a17;
  --critical: var(--brand-red); --critical-soft: var(--accent-soft); --critical-ink: var(--brand-red-ink);
  --neutral-soft: #eceeef; --neutral-ink: #4c555b;
  /* категориальные серии: первые две - фирменные серый и красный */
  --s1: #677279; --s2: #cc1543; --s3: #2a78d6; --s4: #eda100;
  --s5: #1baf7a; --s6: #e87ba4; --s7: #4a3aa7; --s8: #eb6834;
  --grid: #e3e6e8; --axis: #c6cbce;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(38, 44, 48, .06), 0 1px 1px rgba(38, 44, 48, .04);
  --font: "Century Gothic", CenturyGothic, "URW Gothic", "TeX Gyre Adventor", "Segoe UI", Arial, sans-serif;
  --font-head: "Book Antiqua", "Palatino Linotype", Palatino, "TeX Gyre Pagella", Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand-red: #e0335c; --brand-red-ink: #f07a96; --brand-gray: #9aa4aa;
    --bg: #15181a; --surface: #1d2124; --surface-2: #22272a; --surface-3: #2a3034;
    --ink: #eef0f1; --ink-2: #c4cace; --ink-3: #adb7bd; --head: #d3d8db; --line: #2e3438; --line-2: #3c4348;
    --accent-soft: #3a1a24; --accent-hover: #a3102f; --link: #91bce3; --vacant: #5b9be0;
    --side: #1d2124; --side-ink: #c4cace; --side-active: #3a1a24;
    --good-soft: #14301a; --good-ink: #7fd67f; --warning-soft: #3a2e0f; --warning-ink: #f6cd6b;
    --serious-soft: #3d2418; --serious-ink: #f3a684;
    --neutral-soft: #2a3034; --neutral-ink: #c4cace;
    --s1: #9aa4aa; --s2: #e0335c; --s3: #3987e5; --s4: #c98500; --s5: #199e70; --s6: #d55181; --s7: #9085e9; --s8: #d95926;
    --grid: #2e3438; --axis: #3c4348;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand-red: #e0335c; --brand-red-ink: #f07a96; --brand-gray: #9aa4aa;
  --bg: #15181a; --surface: #1d2124; --surface-2: #22272a; --surface-3: #2a3034;
  --ink: #eef0f1; --ink-2: #c4cace; --ink-3: #adb7bd; --head: #d3d8db; --line: #2e3438; --line-2: #3c4348;
  --accent-soft: #3a1a24; --accent-hover: #a3102f; --link: #91bce3; --vacant: #5b9be0;
  --side: #1d2124; --side-ink: #c4cace; --side-active: #3a1a24;
  --good-soft: #14301a; --good-ink: #7fd67f; --warning-soft: #3a2e0f; --warning-ink: #f6cd6b;
  --serious-soft: #3d2418; --serious-ink: #f3a684;
  --neutral-soft: #2a3034; --neutral-ink: #c4cace;
  --s1: #9aa4aa; --s2: #e0335c; --s3: #3987e5; --s4: #c98500; --s5: #199e70; --s6: #d55181; --s7: #9085e9; --s8: #d95926;
  --grid: #2e3438; --axis: #3c4348;
  --shadow: none;
}
/* логотип на тёмном фоне - монохромный белый (брендбук, 2.7) */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-logo { filter: brightness(0) invert(1); } }
:root[data-theme="dark"] .brand-logo { filter: brightness(0) invert(1); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
/* заголовки - Book Antiqua Bold, фирменный серый (брендбук, 2.9) */
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; color: var(--head); }
h1 { font-size: 25px; line-height: 1.2; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 16px 0 8px; }
p { margin: 0 0 8px; }
small, .muted { color: var(--ink-3); }
.ink2 { color: var(--ink-2); }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- каркас: меню слева (компьютер), узкая полоса значков (планшет или «свернуть»), нижняя панель (телефон) */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
html.rail .layout { grid-template-columns: 72px minmax(0, 1fr); }
.side { background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
  border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 40; scrollbar-width: thin; }
/* логотип - в левом верхнем углу, с охранным полем (брендбук, 2.1); подпись - дескриптор по правому краю логотипа (2.6) */
.side-head { position: relative; border-bottom: 1px solid var(--line); margin-bottom: 8px; flex: none; }
.side-head::after { content: ""; position: absolute; left: 22px; bottom: -1px; width: 44px; height: 2px; background: var(--brand-red); }
.brand { display: block; padding: 20px 22px 14px; color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; width: 100%; max-width: 190px; height: auto; }
.brand-sub { display: block; max-width: 190px; margin-top: 5px; text-align: right; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--brand-gray); white-space: nowrap; }
.brand-mark { display: none; padding: 16px 0 12px; justify-content: center; }
.brand-mark img { width: 34px; height: 34px; }
.nav { padding: 0 10px 12px 0; flex: 1; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 19px; margin: 1px 0; border-radius: 0 4px 4px 0; border-left: 3px solid transparent;
  color: var(--side-ink); font-size: 13.5px; white-space: nowrap; }
.nav a:hover { background: var(--surface-3); text-decoration: none; color: var(--ink); }
.nav a .i { color: var(--ink-3); }
.nav a:hover .i { color: var(--ink-2); }
.nav a.active { background: var(--side-active); color: var(--brand-red-ink); border-left-color: var(--brand-red); font-weight: 700; }
.nav a.active .i { color: var(--brand-red); }
.nav .sep { margin: 16px 12px 4px 22px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); white-space: nowrap; }
.nav .count { margin-left: auto; background: var(--critical); color: #fff; border-radius: 9px; font-size: 11px; padding: 0 6px; }
.side-foot { flex: none; border-top: 1px solid var(--line); padding: 8px 10px 10px 0; }
.side-foot button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 12px 8px 22px; border: 0; background: none; color: var(--ink-3);
  font: inherit; font-size: 12.5px; cursor: pointer; border-radius: 0 4px 4px 0; white-space: nowrap; }
.side-foot button:hover { background: var(--surface-3); color: var(--ink); }
html.rail .side-foot .i { transform: scaleX(-1); }
/* узкая полоса: только значки (подписи - во всплывающей подсказке title) */
html.rail body:not(.nav-open) .brand { display: none; }
html.rail body:not(.nav-open) .brand-mark { display: flex; }
html.rail body:not(.nav-open) .side-head::after { left: 14px; }
html.rail body:not(.nav-open) .nav { padding: 0 8px 12px; }
html.rail body:not(.nav-open) .nav a { justify-content: center; padding: 10px 0; border-left: 0; border-radius: 6px; }
html.rail body:not(.nav-open) .nav a.active { box-shadow: inset 3px 0 0 var(--brand-red); }
html.rail body:not(.nav-open) .nav a span, html.rail body:not(.nav-open) .side-foot span { display: none; }
html.rail body:not(.nav-open) .nav .sep { font-size: 0; height: 1px; background: var(--line); margin: 10px 8px; }
html.rail body:not(.nav-open) .side-foot { padding: 8px; }
html.rail body:not(.nav-open) .side-foot button { justify-content: center; padding: 10px 0; border-radius: 6px; }
.scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 28px; min-height: 60px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30; }
.topbar .search { flex: 1; max-width: 520px; position: relative; }
.topbar .search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 18px; height: 18px; pointer-events: none; }
.topbar .search input { width: 100%; height: 38px; padding-left: 38px; background: var(--surface-2); border-radius: 19px; border-color: var(--line); }
.topbar .search input:focus { background: var(--surface); }
.topbar-mark { display: none; }
.topbar .user { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; }
/* страница «Компании» */
.co-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.co-edit { display: inline-block; position: relative; }
.co-edit > summary { list-style: none; display: inline-flex; }
.co-edit > summary::-webkit-details-marker { display: none; }
.co-edit[open] { display: block; margin-top: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); text-align: left; }
.co-edit-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; margin: 8px 0; }
/* переключатель компаний в шапке (ссылки ?co=<код>) */
.co-switch { position: relative; flex: none; }
.co-switch > summary { list-style: none; display: inline-flex; align-items: center; gap: 7px; max-width: 280px; height: 36px; padding: 0 13px;
  border: 1px solid var(--line-2); border-radius: 18px; background: var(--surface); color: var(--ink); font-size: 13px; cursor: pointer; }
.co-switch > summary::-webkit-details-marker { display: none; }
.co-switch > summary .i { width: 17px; height: 17px; color: var(--brand-red); flex: none; }
.co-switch > summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-switch[open] > summary, .co-switch > summary:hover { border-color: var(--brand-red); }
.co-menu { position: absolute; z-index: 45; top: calc(100% + 6px); left: 0; min-width: 270px; max-width: 360px; padding: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(20, 24, 26, .16); }
.co-menu a { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 6px; color: var(--ink); font-size: 13.5px; }
.co-menu a:hover { background: var(--surface-3); text-decoration: none; }
.co-menu a.on { font-weight: 700; color: var(--brand-red-ink); }
.co-menu a i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.icon-btn.icon-danger { width: 34px; height: 34px; color: var(--ink-3); }
.icon-btn.icon-danger:hover { background: var(--critical-soft); color: var(--critical-ink); }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-gray); color: #fff; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; flex: none; }
.uname { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0 4px 0 4px; }
.burger { display: none; }
.content { padding: 22px 28px 48px; max-width: 1640px; width: 100%; }
/* шапка страницы: серая линия с красным отрезком - фирменные линии разделяют смысловые блоки (брендбук, 2.14) */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; padding-bottom: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line-2); position: relative; }
.page-head::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 56px; height: 3px; background: var(--brand-red); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 12.5px; color: var(--ink-3); margin-bottom: 2px; }
.tabbar { display: none; }

/* ---------- блоки */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 16px; }
.card h2 { display: flex; align-items: center; gap: 8px; }
.card h2 .right { margin-left: auto; font-weight: 400; font-size: 13px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.kpi { padding: 14px 16px; border-top: 3px solid var(--brand-gray); }
.kpi .label { color: var(--ink-2); font-size: 12.5px; }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 2px; letter-spacing: -.01em; color: var(--ink); }
.kpi.danger { border-top-color: var(--brand-red); }
.kpi .sub { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.kpi.danger .value { color: var(--critical-ink); }
a.kpi-link { display: block; color: inherit; text-decoration: none; transition: border-color .12s, box-shadow .12s; }
/* история аренды помещения и сравнение договоров */
.history { display: flex; flex-direction: column; gap: 8px; }
.hist-row { display: grid; grid-template-columns: 150px 1fr; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.hist-row.hist-now { border-color: var(--good-ink); background: color-mix(in srgb, var(--good) 12%, transparent); }
.hist-period { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.hist-box .hist-row { grid-template-columns: 1fr; gap: 2px; margin-bottom: 6px; }
table.cmp tr.cmp-changed td { background: color-mix(in srgb, var(--warning) 10%, transparent); }
a.kpi-link:hover { border-color: var(--line-2); border-top-color: var(--brand-red); box-shadow: 0 2px 10px rgba(38, 44, 48, .12); text-decoration: none; }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; }

/* ---------- таблицы */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-weight: 700; color: var(--head); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line-2); background: var(--surface); position: sticky; top: 0; white-space: nowrap; }
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tbody tr:hover td { background: var(--surface-2); }
table.t tr.total td { font-weight: 650; border-top: 1px solid var(--line-2); border-bottom: 0; background: var(--surface-2); }
table.t tr.dim td { color: var(--ink-3); }
table.t.compact td, table.t.compact th { padding: 5px 8px; }
table.t td.actions { white-space: nowrap; text-align: right; }

/* ---------- значки статусов (цвет + текст) */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 550; white-space: nowrap; background: var(--neutral-soft); color: var(--neutral-ink); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.b-ok { background: var(--good-soft); color: var(--good-ink); }
.b-warn { background: var(--warning-soft); color: var(--warning-ink); }
.b-serious { background: var(--serious-soft); color: var(--serious-ink); }
.b-danger { background: var(--critical-soft); color: var(--critical-ink); }
.b-info { background: var(--accent-soft); color: var(--accent); }
.b-note { background: color-mix(in srgb, var(--vacant) 14%, transparent); color: var(--vacant); }
.tag { display: inline-block; padding: 0 6px; border: 1px solid var(--line-2); border-radius: 5px; font-size: 11.5px; color: var(--ink-2); }

/* ---------- кнопки и формы */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); padding: 6px 13px; border-radius: 4px; font: inherit; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--critical-ink); border-color: var(--critical-soft); }
.btn.danger:hover { background: var(--critical-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 3px 8px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: 4px; padding: 6px 9px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--brand-gray); }
input[type=checkbox], input[type=radio] { accent-color: var(--brand-red); }
textarea { width: 100%; min-height: 90px; resize: vertical; }
textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; min-height: 480px; line-height: 1.5; }
input[type=checkbox] { width: 16px; height: 16px; vertical-align: middle; }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.form.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form .wide { grid-column: 1 / -1; }
.form .half { grid-column: span 2; }
/* подзаголовок группы полей: подпись и линия до края */
.form .group { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin: 8px 0 -2px; font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.form .group:first-child { margin-top: 0; }
.form .group::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
/* Длинные подписи переносятся и остаются видимыми на всех экранах. */
.field > label, .field > .label { font-size: 14px; color: var(--ink-2); font-weight: 700; white-space: normal; overflow-wrap: anywhere; }
.hint, .field .hint { font-size: 13px; color: var(--ink-3); line-height: 1.4; }
.field input, .field select, .field textarea { width: 100%; }
.field input[type=checkbox], .field input[type=radio] { width: 16px; height: 16px; flex: none; }
.field input:not([type=checkbox]):not([type=radio]), .field select { height: 36px; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; font-size: 14px; }
.field .check { font-size: 14px; color: var(--ink-2); font-weight: 400; margin-top: 2px; white-space: normal; }
.readonly-value { height: 36px; display: flex; align-items: center; padding: 0 10px; border: 1px dashed var(--line-2); border-radius: 4px;
  background: var(--surface-2); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.inline-form { display: inline; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters .seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 4px; overflow: hidden; background: var(--surface); }
.filters .seg a { padding: 5px 11px; color: var(--ink-2); border-right: 1px solid var(--line-2); font-size: 13px; }
.filters .seg a:last-child { border-right: 0; }
.filters .seg a:hover { text-decoration: none; background: var(--surface-3); }
.filters .seg a.on { background: var(--accent-soft); color: var(--brand-red-ink); font-weight: 700; }
/* поле поиска в фильтрах - широкое, с лупой, как общий поиск */
.filters input[type=search] { flex: 1 1 300px; min-width: 240px; max-width: 520px; height: 34px; padding-left: 34px; border-radius: 17px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e777c' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m20 20-4.2-4.2'/%3E%3C/svg%3E") no-repeat 11px center / 16px; }
.filters select { height: 34px; }

/* ---------- вкладки */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; }
.tabs a { padding: 8px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.on { color: var(--brand-red-ink); border-color: var(--brand-red); font-weight: 700; }
.tab-pane { display: none; }
.tab-pane.on { display: block; }

/* ---------- сообщения */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; border: 1px solid transparent; }
.flash.ok { background: var(--good-soft); color: var(--good-ink); }
.flash.warn { background: var(--warning-soft); color: var(--warning-ink); }
.flash.danger { background: var(--critical-soft); color: var(--critical-ink); }
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-list li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.alert-list li:last-child { border-bottom: 0; }
.alert-list .txt { flex: 1; }
.alert-list small { display: block; }
.empty { color: var(--ink-3); padding: 20px; text-align: center; }
.note { background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: 8px; padding: 10px 12px; color: var(--ink-2); font-size: 13px; }
/* ответ модели по договорам: ссылки на источники */
.answer { margin-top: 14px; padding: 14px 16px; border-left: 3px solid var(--brand-red); background: var(--surface-2); border-radius: 0 6px 6px 0; line-height: 1.6; }
.answer a.cite { font-size: 12px; font-weight: 700; white-space: nowrap; }
.qa-card textarea { min-height: 76px; }
/* фрагмент текста документа с найденными словами (полнотекстовый поиск) */
.snippet { margin-top: 6px; font-size: 12.5px; line-height: 1.5; color: var(--ink-2); max-width: 760px; }
.snippet mark, .answer mark { background: #fff1a8; color: inherit; padding: 0 1px; border-radius: 2px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .snippet mark { background: #5c4d0a; } }
:root[data-theme="dark"] .snippet mark { background: #5c4d0a; }
.review { background: var(--warning-soft); color: var(--warning-ink); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.review a { color: inherit; text-decoration: underline; }

/* ---------- сверка карточки договора со сканами */
.badge svg.i { width: 13px; height: 13px; stroke-width: 2.2; }
.card.scan h2 { display: flex; align-items: center; gap: 8px; }
.card.scan h2 > svg.i { color: var(--brand-red); }
.scan-sum { margin-bottom: 12px; }
.scan-filter { margin-left: auto; font-size: 12.5px; color: var(--ink-2); }
.scan-review { margin: 0 0 12px; }
.scan-ok-msg { display: flex; gap: 8px; align-items: flex-start; }
.scan-ok-msg svg.i { flex: none; width: 18px; height: 18px; margin-top: 1px; }
table.scan-t td:first-child { min-width: 150px; }
table.scan-t td:nth-child(3) { min-width: 240px; }
table.scan-t td:nth-child(4) { white-space: nowrap; }
table.scan-t tr.scan-group td { background: var(--surface-2); color: var(--head); font-weight: 700; font-size: 12.5px; padding-top: 9px; }
table.scan-t tr.scan-diff td { background: color-mix(in srgb, var(--critical) 8%, transparent); }
table.scan-t tbody tr.scan-diff:hover td { background: color-mix(in srgb, var(--critical) 13%, transparent); }
.scan-note { display: block; color: var(--ink-2); }
.scan-frag { display: block; margin-top: 3px; color: var(--ink-3); font-size: 12px; line-height: 1.4; max-width: 560px; overflow-wrap: anywhere; }
.scan-frag mark, .page-text mark { background: #fff1a8; color: inherit; padding: 0 1px; border-radius: 2px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .scan-frag mark, :root:not([data-theme="light"]) .page-text mark { background: #5c4d0a; } }
:root[data-theme="dark"] .scan-frag mark, :root[data-theme="dark"] .page-text mark { background: #5c4d0a; }
.scan-issues tr.scan-ok, .scan-issues tr.scan-info { display: none; }
.scan-bar { display: flex; gap: 10px 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; padding: 12px 16px; }
.scan-bar-text { display: grid; gap: 2px; min-width: 0; }
.scan-num-diff { color: var(--critical-ink); font-weight: 700; }
a.scan-badge:hover { text-decoration: none; filter: brightness(.96); }
.page-text { max-height: 60vh; overflow: auto; font-size: 13px; margin-top: 8px; }

/* ---------- графики */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart rect.bar { rx: 3; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + g rect, .chart g.col:hover rect.bar { filter: brightness(1.08); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tooltip { position: fixed; z-index: 100; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; box-shadow: 0 4px 16px rgba(0,0,0,.14); max-width: 320px; display: none; }
.tooltip b { font-weight: 650; }
.tooltip .tt-row { display: flex; gap: 12px; justify-content: space-between; }
.tooltip .tt-row span:last-child { font-variant-numeric: tabular-nums; }
.meter { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--brand-gray); border-radius: 4px; }

/* ---------- план */
.plan-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
/* карта на весь экран (кнопка ⤢) */
.plan-layout.plan-full { position: fixed; inset: 0; z-index: 90; background: var(--bg); padding: 12px 16px; overflow: auto; }
.plan-layout.plan-full #zfit { background: var(--accent); color: #fff; border-color: var(--accent); }
/* окно карты: высоту до низа экрана задаёт plan.js; план меньше окна - по центру (auto-поля не мешают прокрутке) */
.plan-box { position: relative; display: flex; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; user-select: none; }
.plan-box .plan-stage { position: relative; transform-origin: 0 0; flex: none; margin: auto; }
.plan-box img { display: block; width: 100%; height: auto; pointer-events: none; }
.plan-box svg.overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.plan-box img.dims-layer { position: absolute; inset: 0; width: 100%; height: 100%; }   /* размеры поверх заливки */
.zone.moving { cursor: move; }
.handle.mid { fill: var(--accent); fill-opacity: .55; stroke: #fff; cursor: copy; }
.handle.rot { fill: #fff; stroke: var(--accent); stroke-width: 2.5; cursor: grab; }
.handle.rot:hover { fill: var(--accent); }
.rot-line { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; pointer-events: none; }
/* вкладки страницы карты: «Карта», «Здания» / «Аренда по этажам», «Данные карты» */
.page-tabs { margin: 0 0 14px; }
/* шапка карты компактнее: подпись о собственнике - в строке заголовка, этажи - в строке вкладок */
.plan-head { margin-bottom: 10px; padding-bottom: 8px; }
.plan-head h1 { margin: 0; }
.plan-head .h1-sub { font: 400 13px var(--font); color: var(--ink-3); margin-left: 8px; }
.plan-nav { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 6px 20px; border-bottom: 1px solid var(--line); margin: 0 0 12px; }
.plan-nav .page-tabs { border-bottom: 0; margin: 0; }
.plan-nav .floor-tabs { margin: 0 0 6px auto; }
.page-tabs a { font-size: 14.5px; padding-left: 16px; padding-right: 16px; }
/* карандаш у объекта на карте: правка без перехода в общий режим */
.zone-pencil { position: absolute; z-index: 6; width: 30px; height: 30px; padding: 0; transform: translate(-70%, -30%);
  border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-size: 16px; line-height: 28px;
  text-align: center; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.zone-pencil:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.zone-trash { transform: translate(calc(-70% - 36px), -30%); font-size: 14px; }
.zone-trash:hover { background: var(--critical); border-color: var(--critical); color: #fff; }
.plan-box.inline-edit { outline: 2px solid var(--accent); outline-offset: -2px; }
.zone { fill-opacity: .5; stroke: rgba(20, 20, 19, .55); stroke-width: 1.2; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill-opacity .12s; }
.zone:hover { fill-opacity: .72; }
.zone-b { stroke: #1d2230; stroke-width: 2.2; fill-opacity: .55; }
.zone.noc { stroke: var(--serious); stroke-width: 2.6; stroke-dasharray: 7 4; }
.zone.auto { stroke-dasharray: 2 3; }
.vac { pointer-events: none; }
.plan-legend .lg-org { cursor: pointer; border-radius: 5px; padding: 1px 3px; margin: 0 -3px; }
.plan-legend .lg-org:hover { background: var(--surface-3); }
.crumbs-big { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); margin-bottom: 4px; }
.crumbs-big a { color: var(--ink-2); }
.floor-bar { display: flex; height: 12px; border-radius: 4px; overflow: hidden; background: var(--surface-3); min-width: 160px; }
.floor-bar i { display: block; height: 100%; border-right: 2px solid var(--surface); }
.floor-bar i:last-child { border-right: 0; }
.floor-bar i.vac-seg { background: repeating-linear-gradient(45deg, #f6d6d6 0 4px, #d03b3b 4px 6px); }
.floor-bar i.mop-seg { background: #c9c6bd; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; margin: 1px 6px 1px 0; white-space: nowrap; }
.chip i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.compass { position: absolute; right: 10px; top: 10px; z-index: 3; background: var(--surface); border: 1px solid var(--line); border-radius: 50%; width: 38px; height: 38px; display: grid; place-items: center; font: 600 11px var(--font); color: var(--ink-2); pointer-events: none; }
.compass b { display: block; transform-origin: center; }
.zone.st-rented { fill: var(--good); stroke: var(--good-ink); }
.zone.st-warn { fill: var(--warning); stroke: var(--warning-ink); }
.zone.st-danger { fill: var(--critical); stroke: var(--critical-ink); }
.zone.st-vacant { fill: #8fb3df; stroke: var(--vacant); stroke-dasharray: 5 3; }
.zone.st-na { fill: #bdbab2; stroke: #8a877f; }
.zone.dim { fill-opacity: .08; stroke-opacity: .25; }
.zone.hl { fill: var(--brand-red); stroke: var(--brand-red-ink); fill-opacity: .5; stroke-width: 2.5; }
.zone.sel { stroke: #111; stroke-width: 3; stroke-dasharray: none; fill-opacity: .7; }
.zone-label { font: 600 12px var(--font); fill: #1d1d1b; paint-order: stroke; stroke: rgba(255,255,255,.85); stroke-width: 3px; pointer-events: none; text-anchor: middle; }
.handle { fill: #fff; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; cursor: move; }
.draft { fill: var(--accent); fill-opacity: .2; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-dasharray: 6 3; pointer-events: none; }
.erase-draft { fill: #fff; fill-opacity: .75; stroke: var(--critical); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-dasharray: 5 3; pointer-events: none; }
.measure { stroke: var(--critical); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
/* строения с топосъёмки без литеры и части зданий */
.feat { fill: #e6e3db; fill-opacity: .82; stroke: #4c5263; stroke-width: 1.3; vector-effect: non-scaling-stroke; cursor: pointer; }
.feat:hover { fill: #d8d4c8; }
.feat.sel { fill: var(--accent); fill-opacity: .35; stroke: var(--accent); stroke-width: 2.6; }
.feat-in { fill: none; stroke: #1d2230; stroke-opacity: .55; stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.plan-legend i.lg-feat { background: #e6e3db; border: 1.5px solid #4c5263; }
.plan-legend i.lg-sw { cursor: pointer; }
.plan-legend i.lg-sw:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.org-color { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 13px; }
.org-color input[type=color] { width: 34px; height: 26px; padding: 1px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface); cursor: pointer; }
.plan-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.plan-tools .btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.plan-side .card { padding: 14px; }
/* правая панель карты прокручивается сама - карта при правке остаётся на экране */
@media (min-width: 1200px) {
  .plan-layout > .plan-side:not(.pick-side) { position: sticky; top: 72px; max-height: calc(100vh - 84px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .plan-layout.plan-full > .plan-side:not(.pick-side) { top: 0; max-height: calc(100vh - 24px); }
}
/* карточка правки: название и кнопки сверху и не уезжают при прокрутке; инструменты контура - сразу под ними */
.edit-head { position: sticky; top: -14px; z-index: 3; margin: -14px -14px 10px; padding: 12px 14px 10px; background: var(--surface);
  border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.edit-head h2 { margin: 0 0 8px; }
.edit-sec { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; gap: 6px; background: var(--surface-2); }
.edit-sec-title { font-size: 12px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; }
.edit-help summary { cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
/* планшет и телефон: карточка правки - панелью снизу поверх карты (окно карты укорачивается над ней) */
@media (max-width: 1199px) {
  #panel.edit-open { position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 65; max-height: 46vh; overflow-y: auto;
    overscroll-behavior: contain; border-radius: 14px; box-shadow: 0 -8px 30px rgba(20, 24, 26, .22); }
}
@media (max-width: 767px) {
  #panel.edit-open { bottom: calc(70px + env(safe-area-inset-bottom)); max-height: 50vh; }
}
.plan-legend { display: grid; gap: 6px; font-size: 12.5px; }
.plan-legend span { display: flex; align-items: center; gap: 8px; }
.plan-legend i { width: 14px; height: 14px; border-radius: 3px; border: 1.5px solid; }
.unit-list { max-height: 360px; overflow-y: auto; margin: 0 -6px; }
.unit-list a, .unit-list div.u { display: flex; gap: 8px; padding: 5px 6px; border-radius: 6px; font-size: 13px; align-items: center; color: var(--ink); }
.unit-list a:hover { background: var(--surface-3); text-decoration: none; }
.unit-list .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.plan-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.plan-tabs a { padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 4px; font-size: 13px; color: var(--ink-2); background: var(--surface); }
.plan-tabs a.on { background: var(--accent-soft); border-color: var(--brand-red); color: var(--brand-red-ink); }
.plan-tabs a.has { border-color: var(--brand-red); color: var(--brand-red-ink); font-weight: 700; }
.plan-tabs .b { font-size: 12px; color: var(--ink-3); align-self: center; margin-left: 8px; }
/* выбор помещений для договора: выбранное сейчас - фирменный красный, уже в составе договора - графит с пунктиром */
.zone.pick { fill: var(--brand-red) !important; fill-opacity: .72; stroke: #111; stroke-width: 3; stroke-dasharray: none; }
.zone.pick:hover { fill-opacity: .8; }
.zone.inc { fill: var(--brand-gray-dark) !important; fill-opacity: .55; stroke: #1d2124; stroke-width: 2.4; stroke-dasharray: 6 3; cursor: not-allowed; }
.pick-map .zone:not(.pick):not(.inc):not(.zone-b) { fill-opacity: .38; }   /* выбранное ярче остального */
.pick-map .zone:not(.pick):not(.inc):not(.zone-b):hover { fill-opacity: .6; }
.pick-mark { pointer-events: none; }
.pick-mark circle { fill: var(--brand-red); stroke: #fff; stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.pick-mark path { fill: none; stroke: #fff; stroke-linecap: round; stroke-linejoin: round; }
.tooltip .tt-pick { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); font-weight: 700; color: var(--brand-red-ink); }
/* «Разделить» на карте: линия через помещение, части 1 и 2 (синяя и оранжевая), строка над картой, окно подтверждения */
.split-bar { position: sticky; top: 68px; z-index: 8; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 8px;
  padding: 6px 8px 6px 12px; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent-soft); color: var(--ink);
  font-size: 13px; box-shadow: 0 2px 10px rgba(38, 44, 48, .1); }
.split-bar[hidden] { display: none; }
.plan-full .split-bar { top: 0; }
.split-err { flex-basis: 100%; color: var(--critical-ink); font-weight: 700; }
.split-bar > svg.i { color: var(--accent); width: 18px; height: 18px; }
.split-bar-text { flex: 1 1 240px; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
.sw-part { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border-radius: 3px; border: 1.5px solid; vertical-align: -1px; flex: none; }
.sw-part.p1 { background: rgba(42, 120, 214, .45); border-color: #2a78d6; }
.sw-part.p2 { background: rgba(235, 104, 52, .45); border-color: #eb6834; }
.split-key { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 4px 0 12px; font-size: 13px; }
svg.splitting .zone:not(.split-target) { fill-opacity: .14; stroke-opacity: .3; pointer-events: none; }
svg.splitting .vac, svg.splitting .zone-label:not(.split-label) { opacity: .3; }
.zone.split-target { fill-opacity: .18; stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 6 4; cursor: crosshair; }
.split-part { stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; pointer-events: none; }
.split-part.p1 { fill: #2a78d6; fill-opacity: .5; }
.split-part.p2 { fill: #eb6834; fill-opacity: .5; }
.split-line { stroke: var(--accent); stroke-width: 3; stroke-dasharray: 9 5; stroke-linecap: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.split-draw { stroke: #1d2124; stroke-width: 1.5; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.split-draw.bad { stroke: var(--critical); stroke-width: 2.5; }
.split-dot { fill: #fff; stroke: var(--accent); stroke-width: 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.zone-label.split-label { font-weight: 700; fill: #111; }
dialog.plan-dlg { width: min(620px, calc(100vw - 24px)); max-width: none; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); padding: 0; border: 0;
  border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: 0 16px 48px rgba(0, 0, 0, .3); overflow: auto; overscroll-behavior: contain; }
dialog.plan-dlg::backdrop { background: rgba(20, 24, 26, .45); }
.plan-dlg-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 18px; background: var(--surface);
  border-bottom: 1px solid var(--line); }
.plan-dlg-head::after { content: ""; position: absolute; left: 18px; bottom: -1px; width: 44px; height: 2px; background: var(--brand-red); }
.plan-dlg-head > svg.i { color: var(--brand-red); }
.plan-dlg-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 17px; }
.plan-dlg-body { display: grid; gap: 12px; padding: 14px 18px 4px; }
.plan-dlg-body > p, .plan-dlg-msg .flash { margin: 0; }
.plan-dlg-msg:empty { display: none; }
.plan-dlg-foot { position: sticky; bottom: 0; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; padding: 12px 18px 16px;
  background: var(--surface); border-top: 1px solid var(--line); }   /* кнопки видны и на телефоне, когда окно прокручивается */
.plan-dlg .field > .label { white-space: normal; }
.plan-dlg .field.choice { gap: 6px; }
.plan-dlg .check { align-items: flex-start; line-height: 1.4; }
.plan-dlg .check input { margin-top: 1px; }
.plan-dlg .grid { gap: 12px; }
.split-parts { display: grid; gap: 10px; }
.split-part-card { display: grid; gap: 8px; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.split-part-card h3 { display: flex; align-items: center; flex-wrap: wrap; gap: 0 10px; margin: 0; font-size: 14px; }
.split-part-card h3 small { font: 400 12px var(--font); color: var(--ink-3); }
.split-part-fields { display: grid; grid-template-columns: minmax(0, 1fr) 132px; gap: 10px; }
.split-total { margin: 0; font-size: 13px; color: var(--ink-2); }
.split-total.ok { color: var(--good-ink); }
.split-total.warn { color: var(--warning-ink); font-weight: 700; }
@media (max-width: 767px) { .split-bar { top: 64px; } }
@media (max-width: 600px) {
  .split-part-fields, .plan-dlg .grid.g2 { grid-template-columns: minmax(0, 1fr); }
  .plan-dlg-foot .btn { flex: 1; justify-content: center; }
}

/* ---------- документ */
.doc-preview { background: #fff; color: #111; border: 1px solid var(--line); border-radius: 6px; padding: 36px 44px; font: 13.5px/1.5 "Times New Roman", Times, serif; max-width: 860px; }
.doc-preview p { margin: 0 0 4px; text-align: justify; }
.doc-preview p.h1 { text-align: center; font-weight: 700; font-size: 15px; margin: 0; }
.doc-preview p.h2 { text-align: center; font-weight: 700; margin: 10px 0 4px; }
.doc-preview p.right { text-align: right; }
.doc-preview p.split { display: flex; justify-content: space-between; margin: 6px 0 10px; }
.doc-preview .doc-table { border-collapse: collapse; width: 100%; margin: 6px 0 10px; font-size: 13px; }
.doc-preview .doc-table td { border: 1px solid #555; padding: 3px 6px; vertical-align: top; }
.doc-preview .doc-table td.b { font-weight: 700; }
.doc-preview hr.pb { border-top: 1px dashed #aaa; margin: 18px 0; }
/* план помещений договора (Приложение №1): в предпросмотре документа и в карточке договора */
.doc-preview figure.doc-plan { margin: 12px 0 18px; text-align: center; }
.doc-preview .doc-plan figcaption { font-weight: 700; margin-bottom: 6px; }
.doc-preview .doc-plan img { display: block; max-width: 100%; height: auto; margin: 0 auto; border: 1px solid #c8c8c8; }
.doc-preview .doc-plan-rooms { margin: 6px 0 0; font-size: 12.5px; text-align: justify; }
.doc-preview p.doc-plan-empty { border: 1px dashed #aaa; color: #666; padding: 14px; text-align: center; font-style: italic; }
.plan-sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 16px; }
.plan-sheet { margin: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.plan-sheet-img { display: block; background: #fff; border-bottom: 1px solid var(--line); }   /* чертёж - всегда на белом */
.plan-sheet-img img { display: block; width: 100%; height: auto; }
.plan-sheet figcaption { display: grid; gap: 6px; padding: 10px 12px 12px; font-size: 13px; }
.plan-floors { margin: 8px 0 10px; padding-left: 18px; font-size: 13px; }
.note-sm { font-size: 13px; margin: 6px 0 8px; }
.btn svg.i { width: 16px; height: 16px; }
.diff-old { background: var(--critical-soft); color: var(--critical-ink); text-decoration: line-through; padding: 4px 8px; border-radius: 5px; white-space: pre-wrap; }
.diff-new { background: var(--good-soft); color: var(--good-ink); padding: 4px 8px; border-radius: 5px; white-space: pre-wrap; }
iframe.pdf { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.editor-frame { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; }
.editor-frame .bar { display: flex; gap: 12px; align-items: center; padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.editor-frame #oo { flex: 1; }

/* ---------- вход */
/* как разделы брендбука: светло-серый фон с крупным светлым знаком */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; position: relative; overflow: hidden;
  background: linear-gradient(90deg, #c9cbcd 0, #d3d5d7 55%, #c9cbcd 100%); }
.auth-wrap::before { content: ""; position: absolute; right: -4vw; bottom: -6vh; width: min(62vh, 640px); height: min(62vh, 640px);
  background: url("/static/brand/mark-big.png") center / contain no-repeat; opacity: .55; pointer-events: none; }
.auth-card { width: 100%; max-width: 400px; position: relative; padding: 28px 30px 26px; border: 0; border-top: 3px solid var(--brand-red); border-radius: 4px; box-shadow: 0 8px 30px rgba(38, 44, 48, .16); }
.auth-card .brand { padding: 0 0 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.auth-card .brand-logo { max-width: 230px; }
.auth-card .brand-sub { max-width: 230px; }
.auth-card h1 { font-size: 20px; margin: 0 0 14px; }
.auth-card form .btn, .auth-card > .btn { width: 100%; justify-content: center; padding: 10px 14px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .auth-wrap { background: #121416; } }
:root[data-theme="dark"] .auth-wrap { background: #121416; }

.pager { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.issue { border-left: 3px solid var(--line-2); padding: 6px 10px; margin: 6px 0; background: var(--surface-2); border-radius: 0 6px 6px 0; }
.issue.high { border-color: var(--critical); }
.issue.medium { border-color: var(--warning); }
.issue.low { border-color: var(--line-2); }
.issue .t { font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 6px 0 6px 18px; position: relative; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 11px; width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); }
.timeline li.ok::before { background: var(--good); }
.timeline li.warn::before { background: var(--warning); }
.timeline li.danger::before { background: var(--critical); }
.timeline time { color: var(--ink-3); font-size: 12px; margin-right: 6px; }

/* ---------- монитор: карточки раскладываются по колонкам без пустот (колонки выравниваются по высоте сами) */
.dash { columns: 2 440px; column-gap: 16px; margin-top: 16px; }
.dash > .card { break-inside: avoid; margin: 0 0 16px; display: block; }
.dash > .card + .card { margin-top: 0; }
.list-more { display: block; margin-top: 8px; font-size: 12.5px; }
.grid > .card + .card { margin-top: 0; }
.card h2 .right { font-family: var(--font); font-weight: 400; font-size: 12.5px; }

/* ---------- планшет и узкий компьютер */
@media (max-width: 1199px) {
  .burger { display: inline-grid; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g-main, .plan-layout { grid-template-columns: minmax(0, 1fr); }
  .form.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content { padding: 20px 22px 40px; }
  .topbar { padding: 8px 18px; }
  .side-foot { display: none; }
  /* меню, открытое кнопкой ☰ поверх страницы */
  body.nav-open .side { position: fixed; left: 0; top: 0; bottom: 0; width: 284px; height: auto; z-index: 80; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(20, 24, 26, .38); }
}
/* ---------- телефон: меню выезжает слева, основные разделы - на нижней панели */
@media (max-width: 767px) {
  .layout, html.rail .layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); height: auto; transform: translateX(-105%); transition: transform .2s ease; z-index: 80; }
  body.nav-open .side { transform: none; width: min(300px, 86vw); }
  .burger { display: none; }
  .topbar { padding: 8px 12px; gap: 8px; min-height: 56px; padding-top: max(8px, env(safe-area-inset-top)); }
  .topbar-mark { display: grid; place-items: center; width: 36px; height: 36px; flex: none; }
  .topbar-mark img { width: 30px; height: 30px; }
  .topbar .search input { height: 40px; font-size: 16px; }
  .uname, .avatar { display: none; }
  .co-switch > summary { max-width: 150px; padding: 0 10px; }
  .co-menu { left: auto; right: -60px; min-width: 240px; }
  .content { padding: 16px 14px calc(88px + env(safe-area-inset-bottom)); }
  .page-head { gap: 10px; margin-bottom: 14px; }
  .page-head h1 { font-size: 21px; }
  .page-head .actions { margin-left: 0; width: 100%; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi .value { font-size: 19px; }
  .kpi .sub { font-size: 11.5px; }
  .card { padding: 14px; }
  .form .half { grid-column: auto; }
  .form.cols-4 { grid-template-columns: minmax(0, 1fr); }
  input, select, textarea { font-size: 16px; }   /* без автоматического увеличения страницы на iPhone */
  .btn { padding: 8px 14px; }
  .btn.sm { padding: 5px 10px; }
  .filters .seg { flex: none; max-width: 100%; overflow-x: auto; }
  .filters input[type=search] { flex: 1 1 100%; max-width: none; min-width: 0; height: 40px; border-radius: 20px; }
  .tabs a { padding: 10px 12px; }
  .plan-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin-left: -2px; }
  .plan-tabs a { flex: none; }
  .plan-tools { gap: 8px; }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .dl dt { margin-top: 8px; }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px max(4px, env(safe-area-inset-bottom)); box-shadow: 0 -2px 12px rgba(38, 44, 48, .06); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; border: 0; background: none;
    color: var(--ink-3); font: inherit; font-size: 10.5px; text-decoration: none; cursor: pointer; border-radius: 8px; }
  .tabbar .i { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--brand-red); font-weight: 700; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(20, 24, 26, .38); }
  /* таблицы - карточками: подписи столбцов ставит app.js (data-label) */
  table.t:not(.keep), table.t:not(.keep) tbody, table.t:not(.keep) tr, table.t:not(.keep) td { display: block; width: 100%; }
  table.t:not(.keep) thead { display: none; }
  table.t:not(.keep) tfoot { display: block; }   /* строка «Итого» - такой же карточкой, как строки таблицы */
  table.t:not(.keep) tr { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; margin-bottom: 8px; background: var(--surface); }
  table.t:not(.keep) tbody tr:hover td { background: none; }
  table.t:not(.keep) td { border: 0; padding: 4px 0; display: flow-root; text-align: right; white-space: normal; }
  table.t:not(.keep) td::before { content: attr(data-label); float: left; max-width: 46%; margin-right: 12px; color: var(--ink-3); font-size: 12px; text-align: left; font-weight: 400; }
  table.t:not(.keep) td:first-child { font-weight: 700; font-size: 14px; text-align: left; padding-bottom: 6px; }
  table.t:not(.keep) td:first-child::before, table.t:not(.keep) td[colspan]::before { display: none; }
  table.t:not(.keep) td:empty { display: none; }
  table.t:not(.keep) td.actions { padding-top: 8px; }
  table.t:not(.keep) tr.total { background: var(--surface-2); }
  .table-wrap { margin: 0; padding: 0; }
  table.scan-t tr.scan-group { border: 0; background: none; padding: 10px 2px 2px; margin-bottom: 4px; }
  table.scan-t tr.scan-group td { background: none; padding: 0; font-size: 13px; }
  table.scan-t td:nth-child(3), table.scan-t td:first-child { min-width: 0; }
  .scan-filter { margin-left: 0; }
  .card.scan h2 { flex-wrap: wrap; }
  .card.scan h2 .right { margin-left: 0; width: 100%; }
}
@media print {
  .side, .topbar, .tabbar, .actions, .btn, .filters, .tabs { display: none !important; }
  .layout { display: block; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* ---------- настройки: единый выбор раздела и форма на всю доступную ширину */
.settings-layout { display: block; }
.settings-main { min-width: 0; max-width: 980px; }
.settings-main.wide { max-width: none; }
.settings-back { margin-bottom: 18px; }
.settings-back a { display: inline-flex; min-height: 36px; align-items: center; }
.settings-search { max-width: 700px; margin-bottom: 16px; }
.settings-search label { display: block; font-weight: 700; margin-bottom: 6px; }
.settings-search input { flex: 1; min-width: 0; height: 44px; }
.settings-jumps { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 26px; }
.settings-jumps a { padding: 6px 0; }
.settings-group { margin: 26px 0; scroll-margin-top: 88px; }
.settings-group > h2 { margin-bottom: 12px; }
.settings-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.settings-card { display: flex; align-items: flex-start; gap: 12px; padding: 18px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.settings-card > .i { flex: none; margin-top: 3px; color: var(--brand-gray); width: 22px; height: 22px; }
.settings-card > div { flex: 1; min-width: 0; }
.settings-card h3 { margin: 0 0 6px; font-family: var(--font); font-size: 15px; line-height: 1.4; }
.settings-card p { margin: 0; color: var(--ink-2); font-size: 13px; line-height: 1.5; }
.settings-card-arrow { color: var(--ink-3); }
.settings-card:hover { text-decoration: none; border-color: var(--brand-gray); background: var(--surface-2); }
.settings-card:focus-visible { outline: 2px solid var(--brand-red); outline-offset: 3px; }
.settings-card[hidden], .settings-group[hidden], .settings-jumps[hidden], #settings-search-clear[hidden] { display: none; }
@media (max-width: 1199px) { .settings-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.settings-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; align-items: start; }
.settings-fields > .setting-wide { grid-column: 1 / -1; }
.settings-save { position: sticky; bottom: 12px; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px 16px; margin-top: 24px; padding: 12px 0; border-top: 1px solid var(--line-2); background: var(--surface); }
.settings-save > .muted { flex: 1 1 240px; font-size: 13px; }
.settings-save > .btn { white-space: normal; text-align: center; }
@media (max-width: 767px) {
  .settings-cards { grid-template-columns: minmax(0, 1fr); }
  .settings-card { padding: 16px; }
  .settings-jumps { gap: 4px 14px; }
  .settings-fields { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .settings-save { bottom: calc(68px + env(safe-area-inset-bottom)); padding: 10px 0; gap: 8px; }
  .settings-save > .muted { flex-basis: 100%; }
  .settings-save > .btn { width: 100%; justify-content: center; min-height: 44px; }
}
@media print { .settings-save { display: none; } }

/* ---------- карточка пользователя: роли плитками, итоговый доступ */
.user-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.role-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.role-tile { position: relative; display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 6px;
  background: var(--surface); cursor: pointer; transition: border-color .12s, background .12s; }
.role-tile:hover { border-color: var(--brand-gray); }
.role-tile input { position: absolute; opacity: 0; pointer-events: none; }
.rt-check { flex: none; width: 20px; height: 20px; margin-top: 1px; border: 1.5px solid var(--line-2); border-radius: 4px; background: var(--surface); }
.role-tile.on { border-color: var(--brand-red); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--brand-red); }
.role-tile.on .rt-check { background: var(--brand-red); border-color: var(--brand-red); }
.role-tile.on .rt-check::after { content: ""; display: block; width: 6px; height: 11px; margin: 2px 0 0 6px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.role-tile input:focus-visible + .rt-check { outline: 2px solid var(--brand-red); outline-offset: 2px; }
.role-tile.locked { cursor: default; opacity: .85; }
.rt-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rt-name { font-size: 14px; }
.rt-descr { font-size: 12.5px; color: var(--ink-2); }
.rt-rights { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; font-size: 11.5px; color: var(--ink-3); line-height: 1.4; }
.rt-note { font-size: 11.5px; color: var(--brand-red-ink); margin-top: 2px; }
.lvl-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.lvl-dot.lvl-edit { background: var(--good); }
.lvl-dot.lvl-view { background: var(--brand-gray); }
.rights-preview td { padding: 6px 8px; }
.rights-preview td.lvl-cell { text-align: right; white-space: nowrap; }
.lvl.lvl-view { background: var(--surface-3); color: var(--ink); }
.lvl.lvl-none { background: transparent; color: var(--ink-3); border: 1px dashed var(--line-2); font-weight: 400; }
.users-list td { vertical-align: middle; }
@media (max-width: 1100px) { .user-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- права доступа */
/* раздел только для просмотра: кнопки и формы изменения скрыты (сервер всё равно проверяет права) */
body.read-only .content form[method=post]:not([data-view-exempt]), body.read-only .content form[method=POST]:not([data-view-exempt]),
body.read-only .content a[href$="/new"], body.read-only .content a[href*="/edit"]:not([data-view]), body.read-only .content a[href*="/amend"],
body.read-only .content a[href$="/generate"], body.read-only .content a[href*="mode=edit"], body.read-only .content [data-edit] { display: none !important; }
body.read-only .content a[href*="/new?"], body.read-only .content a[href*="/generate?"] { display:none !important; }
.ro-badge { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 12px; font-weight: 700;
  color: var(--brand-gray-dark); background: var(--surface-3); border: 1px solid var(--line-2); white-space: nowrap; }
.access-matrix td, .access-matrix th { text-align: center; vertical-align: middle; }
.access-matrix td:first-child, .access-matrix th:first-child { text-align: left; white-space: nowrap; }
.lvl-select { height: 32px; padding: 2px 6px; font-size: 12.5px; border-radius: 4px; min-width: 120px; }
.lvl-select[data-lvl="edit"], .lvl.lvl-edit { background: var(--good-soft); color: var(--good-ink); border-color: transparent; }
.lvl-select[data-lvl="view"] { background: var(--surface-3); color: var(--ink); border-color: transparent; }
.lvl-select[data-lvl="none"] { background: transparent; color: var(--ink-3); border: 1px dashed var(--line-2); }
.lvl { display: inline-block; padding: 5px 10px; border-radius: 4px; font-size: 12.5px; font-weight: 700; }
.access-roles input { height: 34px; }
.role-checks { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 2px 0 6px; }
.role-checks .check { font-size: 12.5px; white-space: nowrap; }
.users-table .role-checks { display: grid; grid-template-columns: repeat(2, max-content); gap: 2px 16px; }
.users-table td:nth-child(3) { min-width: 320px; }
.users-table td.actions { white-space: normal; min-width: 240px; }
.role-form .btn { margin-top: 2px; }
.users-table .badge { margin: 1px 4px 1px 0; }
.badge.role-admin { background: var(--accent-soft); color: var(--brand-red-ink); }
.pw-form { display: inline-flex; gap: 6px; margin-top: 6px; }
.pw-form input { width: 130px; height: 30px; }
ol.howto { margin: 0 0 10px; padding-left: 20px; }
ol.howto li { margin-bottom: 6px; }

/* вкладки «Данные карты» */
#add-plan { margin-top: 16px; scroll-margin-top: 64px; }
#add-plan .tabs { flex-wrap: wrap; overflow: visible; }
#add-plan [role="tabpanel"] > p.muted { margin-bottom: 12px; }
#mapDataBtn[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ---------- состав объекта в форме договора: «Выбрать на карте» и новые строки */
.btn.sm svg.i { width: 16px; height: 16px; }
.rows-actions { margin-top: 8px; }
.contract-form-tenant { min-width: 0; padding-top: 4px; scroll-margin-top: 84px; }
.contract-form-tenant fieldset { margin: 0; min-inline-size: 0; }
.contract-form-tenant legend { padding: 0 6px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.contract-form-tenant .rows-actions .btn { white-space: normal; text-align: left; }
.contract-form-map-actions { margin: 8px 0 16px; gap: 10px 16px; }
.contract-form-map-actions > .muted { flex: 1 1 280px; font-size: 13px; }
.contract-form-map-actions > .btn { white-space: normal; text-align: left; }
.pick-note { margin: 8px 0 0; }
table.t tr.row-new td { animation: row-new 2.6s ease-out; }
@keyframes row-new { from { background: var(--accent-soft); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { table.t tr.row-new td { animation: none; } }

/* окно «Выбрать на карте»: во всю высоту экрана (на телефоне - во весь экран), карта - во фрейме */
dialog.map-pick { width: min(1600px, calc(100vw - 48px)); max-width: none; height: 100vh; height: 100dvh; max-height: none; margin: 0 auto;
  padding: 0; border: 0; border-radius: 0; background: var(--bg); color: var(--ink); box-shadow: 0 0 60px rgba(0, 0, 0, .35); overflow: hidden; }
dialog.map-pick[open] { display: flex; flex-direction: column; }
dialog.map-pick::backdrop { background: rgba(20, 24, 26, .55); }
.map-pick-head { flex: none; position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 18px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
.map-pick-head::after { content: ""; position: absolute; left: 18px; bottom: -1px; width: 44px; height: 2px; background: var(--brand-red); }
.map-pick-head > svg.i { color: var(--brand-red); }
.map-pick-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-pick-body { flex: 1; min-height: 0; position: relative; }
.map-pick-body iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--bg); }
.map-pick-wait { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); background: var(--bg); }
dialog.map-pick.ready .map-pick-wait { display: none; }
html.dlg-open { overflow: hidden; }

/* ---------- встроенная страница (окно выбора на карте): без меню, шапки и нижней панели, во всю высоту фрейма */
body.embed { overflow: hidden; }
body.embed .content { height: 100vh; height: 100dvh; max-width: none; padding: 10px 16px 12px; display: flex; flex-direction: column; gap: 8px; }
body.embed .content > .flash { flex: none; margin: 0; }
.pick-top { flex: none; margin: 0; font-size: 13.5px; }
.pick-top b { color: var(--ink); }
.pick-map { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pick-map > .plan-tabs { flex: none; margin-bottom: 8px; }
.pick-map > .plan-layout { flex: 1; min-height: 0; grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: minmax(0, 1fr); align-items: stretch; gap: 14px; }
.pick-map .plan-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pick-map .plan-tools { flex: none; margin-bottom: 8px; }
.pick-map .plan-wrap { flex: 1; min-height: 0; }
.pick-map .plan-box { height: 100%; max-height: none !important; }
.pick-map .plan-legend .lg-org, .pick-map .plan-legend span { cursor: default; }
.pick-side { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; }
.pick-side .card { padding: 14px; }
.pick-side .card + .card { margin-top: 0; }
.pick-card > .flash { margin-bottom: 10px; padding: 8px 12px; font-size: 13px; }
/* список выбранного */
.pick-bar { display: grid; gap: 10px; }
.pick-title { margin: 0; font-size: 16px; }
.pick-title .right { font-size: 14px; color: var(--ink); font-weight: 700; }
.pick-sum { display: none; }
.pick-add { justify-content: center; width: 100%; padding: 9px 14px; }
.pick-body { margin-top: 10px; }
.pick-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.pick-list li { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.pick-name { flex: 1; min-width: 0; font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.pick-name small { display: block; font-size: 11.5px; color: var(--ink-3); }
.pick-list .num { font-size: 13px; }
.pick-x { width: 30px; height: 30px; color: var(--ink-3); }
.pick-x svg.i { width: 16px; height: 16px; }
.pick-x:hover { color: var(--critical-ink); }
.pick-total { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0 6px; font-size: 13.5px; }
.pick-empty { margin: 0; font-size: 13px; }
.pick-hint { margin: 8px 0 0; font-size: 12px; }
.pick-key { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.pick-key span { display: inline-flex; align-items: center; gap: 6px; }
.pick-key i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; }
.pick-key .k-pick { background: color-mix(in srgb, var(--brand-red) 72%, #fff); border: 2px solid #111; }
.pick-key .k-inc { background: color-mix(in srgb, #454e54 55%, #fff); border: 2px dashed #1d2124; }
/* здание без поэтажных планов: объекты списком */
.pick-nolist { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.pick-units { border-top: 1px solid var(--line); }
.pick-unit { display: flex; align-items: center; gap: 10px; padding: 8px 0 8px calc(var(--depth, 0) * 18px); border-bottom: 1px solid var(--line); }
.pick-unit-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pick-unit-name small { display: block; color: var(--ink-3); }
@media (max-width: 767px) {
  dialog.map-pick { width: 100vw; }
  .map-pick-head { padding: max(6px, env(safe-area-inset-top)) 6px 6px 14px; }
  .map-pick-head h2 { font-size: 16px; }
  body.embed .content { padding: 8px 10px 0; gap: 6px; }
  .pick-map > .plan-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 0; }
  /* список выбранного - лист внизу во всю ширину: строка «Выбрано · м²» и кнопка, список разворачивается */
  .pick-side { overflow: visible; margin: 0 -10px; gap: 0; }
  .pick-legend { display: none; }
  .pick-side .pick-card { border-radius: 0; border-width: 1px 0 0; box-shadow: 0 -4px 16px rgba(38, 44, 48, .1);
    padding: 8px 12px max(8px, env(safe-area-inset-bottom)); }
  .pick-bar { display: flex; align-items: center; gap: 10px; }
  .pick .pick-title { display: none; }
  /* инструменты карты в одну строку: «размеры» на телефоне скрыты */
  .pick-map .plan-tools { flex-wrap: nowrap; gap: 6px; }
  .pick-map .plan-tools select { flex: 1 1 auto; min-width: 0; max-width: 220px; }
  .pick-map .plan-tools .dims-check { display: none; }
  .pick-sum { display: flex; flex: 1; min-width: 0; align-items: center; gap: 6px; padding: 8px 0; border: 0; background: none; color: var(--ink);
    font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
  .pick-sum span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pick-sum svg.i { width: 18px; height: 18px; transform: rotate(180deg); transition: transform .15s; }
  .pick.open .pick-sum svg.i { transform: none; }
  .pick-add { width: auto; flex: none; }
  .pick-body { display: none; max-height: 42vh; overflow-y: auto; margin-top: 4px; }
  .pick.open .pick-body, .pick.is-empty .pick-body { display: block; }
  .pick-sum:disabled { color: var(--ink); opacity: 1; cursor: default; }
  .pick.is-empty .pick-sum svg.i { display: none; }
  .pick-key { margin-top: 6px; }
  .pick-nolist { border-radius: 0; }
}

/* ---------- счётчики: список, карточка, ведомость показаний (на телефоне - крупные поля для обхода здания) */
.mt-res { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.mt-res i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.tag.mt-p-main { border-color: var(--brand-gray); color: var(--ink); }
.tag.mt-p-sub { border-color: color-mix(in srgb, var(--vacant) 55%, transparent); color: var(--vacant); }
.tag.mt-p-tech { border-style: dashed; }
.mt-vals { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 0 10px; }
.mt-vals small { color: var(--ink-3); }
.mt-kpis { margin-bottom: 16px; }
.mt-kpi-v { font-size: 20px; }
.mt-filters .mt-month { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.mt-filters input[type=month] { height: 34px; }
.mt-note { font-size: 12.5px; margin: 8px 0 0; }
.mt-model { font: 400 15px var(--font); color: var(--ink-3); margin-left: 6px; }
.mt-export form label { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.mt-photo-link { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.mt-photo-link svg.i { width: 15px; height: 15px; }
table.t tr.mt-row-err td { background: color-mix(in srgb, var(--critical) 7%, transparent); }
.mt-sub { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-top: 6px; }
.mt-replace > summary { list-style: none; margin-bottom: 4px; }
.mt-replace > summary::-webkit-details-marker { display: none; }
.mt-replace[open] > summary { background: var(--surface-3); }
.mt-zone-grid { gap: 10px; }
.mt-legend { margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.mt-legend p { margin: 0 0 6px; }
table.mt-recon td:first-child { min-width: 150px; }
.mt-live { font-variant-numeric: tabular-nums; }
.mt-add-btn { margin-top: 10px; }
.mt-add.is-err .mt-msg { color: var(--critical-ink); font-weight: 700; }
.mt-add.is-err .mt-input { border-color: var(--critical); }
.mt-add.is-warn .mt-msg { color: var(--warning-ink); font-weight: 700; }
.mt-add.is-warn .mt-live { border-color: var(--warning); }
[data-zone-field][hidden] { display: none; }
.mt-table .mt-serial { white-space: nowrap; }
.mt-cam-wide { justify-content: center; height: 36px; }
.card h2 .right.row { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
/* короткий список счётчиков (карточка помещения) */
.mt-list { margin: 0 -6px; }
.mt-li { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 6px; color: var(--ink); }
.mt-li + .mt-li { border-top: 1px solid var(--line); }
.mt-li:hover { background: var(--surface-3); text-decoration: none; }
.mt-li.dim { opacity: .65; }
.mt-li-main { flex: 1; min-width: 0; font-size: 13px; }
.mt-li-main .mt-res { margin-left: 4px; font-size: 12.5px; color: var(--ink-2); }
.mt-li-main small { display: block; color: var(--ink-3); font-size: 12px; overflow-wrap: anywhere; }
.mt-li-val { flex: none; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mt-bad { color: var(--critical-ink); font-weight: 700; }
.mt-soon { color: var(--warning-ink); font-weight: 700; }

/* ведомость: строка счётчика - сетка из пяти колонок (на телефоне - карточка) */
.mt-sheet-top { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.mt-sheet-top .field { width: 190px; }
.mt-sheet-top p { flex: 1 1 320px; margin: 0; font-size: 12.5px; }
.mt-head, .mt-row { display: grid; grid-template-columns: minmax(190px, 1.4fr) minmax(120px, .9fr) minmax(190px, 1.3fr) minmax(120px, .8fr) minmax(150px, 1fr);
  gap: 6px 14px; align-items: center; }
.mt-head { padding: 0 10px 6px; border-bottom: 1px solid var(--line-2); font-size: 12px; font-weight: 700; color: var(--head); }
.mt-row { padding: 10px; border-bottom: 1px solid var(--line); border-radius: 4px; }
.mt-row:last-child { border-bottom: 0; }
.mt-row > div { min-width: 0; }
.mt-c-meter small, .mt-c-prev small, .mt-c-cons small, .mt-c-new small { display: block; color: var(--ink-3); font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }
.mt-c-meter .mt-res { font-size: 12.5px; color: var(--ink-2); margin-left: 4px; }
.mt-serial { font-weight: 700; }
.mt-c-prev b, .mt-c-cons b { font-variant-numeric: tabular-nums; }
.mt-lbl { display: none; font-size: 12px; color: var(--ink-3); }
.mt-c-new { display: grid; gap: 6px; }
.mt-c-new.z2, .mt-c-new.z3 { grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); }
.mt-c-new.z2 .mt-lbl, .mt-c-new.z3 .mt-lbl { display: block; }
.mt-in { display: grid; gap: 2px; }
.mt-in input { width: 100%; height: 38px; font-size: 16px; font-variant-numeric: tabular-nums; }
.mt-c-photo { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.mt-cam { position: relative; overflow: hidden; }
.mt-cam input[type=file] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; font-size: 0; }
.mt-cam.has-photo { border-color: var(--good); color: var(--good-ink); background: var(--good-soft); }
.mt-more summary { cursor: pointer; font-size: 12.5px; color: var(--ink-3); }
.mt-more input { width: 100%; margin-top: 4px; }
.mt-row.is-saved .mt-msg { color: var(--good-ink); }
.mt-row.is-filled { box-shadow: inset 3px 0 0 var(--good); }
.mt-row.is-warn { background: color-mix(in srgb, var(--warning) 12%, transparent); box-shadow: inset 3px 0 0 var(--warning); }
.mt-row.is-warn .mt-msg { color: var(--warning-ink); font-weight: 700; }
.mt-row.is-err { background: color-mix(in srgb, var(--critical) 8%, transparent); box-shadow: inset 3px 0 0 var(--critical); }
.mt-row.is-err .mt-msg { color: var(--critical-ink); font-weight: 700; }
.mt-row.is-err .mt-in input { border-color: var(--critical); }
.mt-bar { position: sticky; bottom: 12px; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px;
  padding: 10px 12px 10px 16px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: 0 4px 18px rgba(38, 44, 48, .14); }
.mt-bar-text { color: var(--ink-2); }
.mt-n-errs b { color: var(--critical-ink); }
.mt-n-warns b { color: var(--warning-ink); }
.mt-group + .mt-group { margin-top: 16px; }
@media (max-width: 1100px) {
  .mt-head { display: none; }
  .mt-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "meter meter" "prev cons" "new photo"; padding: 12px 10px; }
  .mt-c-meter { grid-area: meter; }
  .mt-c-prev { grid-area: prev; }
  .mt-c-cons { grid-area: cons; }
  .mt-c-new { grid-area: new; }
  .mt-c-photo { grid-area: photo; align-self: end; }
  .mt-lbl { display: block; }
}
@media (max-width: 767px) {
  .mt-row { grid-template-areas: "meter meter" "prev cons" "new new" "photo photo"; gap: 8px 12px; padding: 12px 4px; }
  .mt-in input { height: 50px; font-size: 21px; padding: 6px 12px; }
  .mt-c-new.z2, .mt-c-new.z3 { grid-template-columns: minmax(0, 1fr); }
  .mt-cam { padding: 9px 14px; font-size: 14px; }
  .mt-sheet-top .field { width: 100%; }
  .mt-bar { bottom: calc(66px + env(safe-area-inset-bottom)); padding: 8px 8px 8px 14px; }
  .mt-bar .btn { padding: 11px 18px; font-size: 15px; }
  .mt-filters label.check { font-size: 14px; }
  /* фильтры - сеткой в две колонки, главная кнопка страницы - первой */
  .mt-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mt-filters > * { width: 100%; min-width: 0; }
  .mt-filters .mt-month input { flex: 1; min-width: 0; }
  .mt-filters input[type=search], .mt-filters label.check, .mt-filters .mt-month { grid-column: 1 / -1; }
  .mt-actions .btn.primary { order: -1; flex: 1 1 100%; justify-content: center; }
  .page-head .mt-hide-phone { display: none; }
  .mt-sheet-top p { display: none; }
}
@media print { .mt-bar, .mt-c-photo { display: none !important; } }
/* ---------- документы организации (вкладка карточки арендатора) */
.td-head-flags { margin-top: 6px; }
.td-flag { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.td-flag:hover { text-decoration: none; }
.doc-flags { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.doc-flags:hover { text-decoration: none; }
a.badge:hover { text-decoration: none; filter: brightness(.97); }
.td-layout { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(330px, 1fr); gap: 16px; align-items: start; }
.td-layout > .stack { min-width: 0; }
.td-overview { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.td-overview > div:first-child { flex: 1 1 260px; min-width: 0; }
.td-overview strong { display: block; margin-bottom: 8px; }
.td-overview .doc-flags { display: flex; align-items: center; gap: 8px; }
.td-overview .row { flex-wrap: wrap; }
.td-overview .btn { white-space: normal; text-align: center; }
.td-col-side > details, .td-review, .td-links { scroll-margin-top: 84px; }
.td-col-side > details > summary { cursor: pointer; color: var(--head); font-family: var(--font-head); font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.td-col-side > details > summary::marker { color: var(--brand-red); }
.td-col-side > details > summary:focus-visible { outline: 2px solid var(--brand-red); outline-offset: 4px; border-radius: 2px; }
.td-col-side > details[open] > summary { margin-bottom: 14px; }
.td-col-side .td-fields, .td-col-side .td-2 { grid-template-columns: minmax(0, 1fr); }
.td-col-side .td-kinds { grid-template-columns: minmax(0, 1fr); }
.card h2 > svg.i { color: var(--brand-red); width: 18px; height: 18px; }
.td-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.td-search { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: -4px 0 12px; }
.td-search input[type=search] { flex: 1 1 160px; min-width: 0; height: 34px; padding-left: 34px; border-radius: 17px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e777c' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m20 20-4.2-4.2'/%3E%3C/svg%3E") no-repeat 11px center / 16px; }
.td-group + .td-group { margin-top: 18px; }
.td-group h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 14.5px; }
.td-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.td-doc { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 10px 4px; border-bottom: 1px solid var(--line); scroll-margin-top: 84px; }
.td-doc:target { background: var(--accent-soft); border-radius: 4px; }
.td-ico { display: grid; place-items: center; width: 38px; height: 46px; border: 1px solid var(--line-2); border-radius: 3px 10px 3px 3px; background: var(--surface-2);
  color: var(--ink-2); font-size: 9.5px; font-weight: 700; letter-spacing: .04em; }
.td-ico:hover { border-color: var(--brand-red); color: var(--brand-red-ink); text-decoration: none; }
.td-main { min-width: 0; display: grid; gap: 2px; }
.td-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-weight: 700; overflow-wrap: anywhere; }
.td-meta { font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.td-why { color: var(--ink-3); }
.td-comment { font-size: 12.5px; color: var(--ink-2); white-space: pre-wrap; }
.td-reason { font-size: 12.5px; color: var(--critical-ink); }
.td-kind { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.td-pend { grid-template-columns: 38px minmax(0, 1fr); }
.td-pend .td-actions { grid-column: 2; justify-content: flex-start; }
.td-pend .td-pop { left: 0; right: auto; }
.td-pop-links { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; }
.td-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: flex-start; }
.td-actions form { margin: 0; }
.td-more { position: relative; }
.td-more > summary { list-style: none; }
.td-more > summary::-webkit-details-marker { display: none; }
.td-more[open] > summary { background: var(--surface-3); border-color: var(--brand-gray); }
.td-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; width: min(380px, calc(100vw - 32px)); display: grid; gap: 12px; padding: 14px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: 0 10px 32px rgba(20, 24, 26, .2); text-align: left; }
.td-pop > form + form, .td-pop > .td-versions + form, .td-pop > form + .td-versions { border-top: 1px solid var(--line); padding-top: 12px; }
.td-pop .field > label { white-space: normal; }
.td-replace { display: grid; gap: 8px; }
.td-replace .btn { justify-self: start; }
.td-versions { display: grid; gap: 2px; font-size: 12.5px; }
.td-review { border-color: color-mix(in srgb, var(--vacant) 45%, var(--line)); box-shadow: inset 3px 0 0 var(--vacant); }
.td-review h2 > svg.i { color: var(--vacant); }
.td-pend { background: color-mix(in srgb, var(--vacant) 5%, transparent); }
/* чек-лист обязательных документов */
.ck-type { margin: -6px 0 8px; }
.ck-list { list-style: none; margin: 0; padding: 0; }
.ck-list li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--line); }
.ck-list li:last-child { border-bottom: 0; }
.ck-ico { flex: none; display: grid; place-items: center; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; }
.ck-ico svg.i { width: 14px; height: 14px; stroke-width: 2.6; }
.ck-ok .ck-ico { background: var(--good-soft); color: var(--good-ink); }
.ck-warn .ck-ico { background: var(--warning-soft); color: var(--warning-ink); }
.ck-wait .ck-ico { background: color-mix(in srgb, var(--vacant) 16%, transparent); color: var(--vacant); }
.ck-bad .ck-ico { background: var(--critical-soft); color: var(--critical-ink); }
.ck-txt { flex: 1; min-width: 0; font-size: 13.5px; }
.ck-txt small { display: block; font-size: 12px; color: var(--ink-3); }
.ck-bad .ck-txt small { color: var(--critical-ink); }
.ck-sum { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 0; }
/* загрузка: блок выбора файлов (кнопка, перетаскивание, камера телефона) */
.td-upload, .td-request-form { display: grid; gap: 12px; }
.td-upload h2 { margin: 0; }
.td-upload .btn.primary, .td-request-form .btn.primary { justify-self: start; }
/* «Запросить документы»: заголовок раскрывает форму */
.td-request > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
.td-request > summary::-webkit-details-marker { display: none; }
.td-request > summary h2 { flex: 1; margin: 0; }
.td-request > summary .td-link-ico { color: var(--brand-red); width: 18px; height: 18px; }
.td-request > summary .td-chev { color: var(--ink-3); transition: transform .15s; }
.td-request[open] > summary .td-chev { transform: rotate(180deg); }
.td-request > summary:hover h2 { color: var(--brand-red-ink); }
.td-request-form { margin-top: 12px; }
.td-fields { display: grid; gap: 10px; }
.dz { position: relative; display: grid; gap: 8px; }
.dz-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 20px 14px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: var(--surface-2); color: var(--ink-2); transition: border-color .12s, background .12s; }
.dz-zone > svg.i { width: 28px; height: 28px; color: var(--brand-red); }
.dz-zone small { color: var(--ink-3); }
.dz-zone:hover, .dz.drag .dz-zone { border-color: var(--brand-red); background: var(--accent-soft); }
.dz.js .dz-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dz-input:focus-visible + .dz-zone, .dz-input:focus-visible + .dz-zone .btn:first-child { outline: 2px solid var(--brand-red); outline-offset: 2px; }
.dz-cam { display: none; justify-content: center; }
@media (hover: none) and (pointer: coarse) { .dz-cam { display: inline-flex; } }
.dz-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.dz-list:empty { display: none; }
.dz-list li { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 3px 3px 3px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 13px; }
.dz-list li.bad { border-color: var(--critical); background: var(--critical-soft); }
.dz-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-size { color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12px; }
.dz-err { color: var(--critical-ink); font-weight: 700; font-size: 12px; }
.dz-x { width: 30px; height: 30px; color: var(--ink-3); }
.dz-x svg.i { width: 16px; height: 16px; }
.dz-x:hover { color: var(--critical-ink); }
.dz-msg:empty { display: none; }
.dz-msg .flash { margin: 0; }
/* запрос документов и ссылки */
.td-kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 5px 14px; margin: 0; padding: 0; border: 0; min-width: 0; }
.td-kinds legend { padding: 0; margin-bottom: 6px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.td-kinds .check { align-items: flex-start; font-size: 14px; line-height: 1.4; }
.td-kinds .check input, .multi-check .check input { flex: none; margin-top: 1px; }
.td-request-form > .check { font-size: 14px; align-items: flex-start; overflow-wrap: anywhere; }
.td-request-form > .check input { flex: none; margin-top: 1px; }
.td-net { margin: 0; overflow-wrap: anywhere; }
.td-link { display: grid; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.td-link:last-of-type { border-bottom: 0; }
.td-link small { color: var(--ink-3); }
.td-link form { margin-top: 2px; }
.copy-row { display: flex; gap: 6px; }
.copy-row input { flex: 1; min-width: 0; height: 32px; font-size: 12px; background: var(--surface-2); }
.td-old { margin-top: 8px; font-size: 13px; }
.td-old summary { cursor: pointer; color: var(--ink-2); }
/* настройки: несколько отметок в одном поле */
.multi-check { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 6px 16px; padding: 4px 0; }
.multi-check .check { font-size: 14px; align-items: flex-start; }
@media (max-width: 1199px) {
  /* Одна колонка сохраняет порядок DOM: документы, проверка, затем боковые блоки. */
  .td-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .td-overview { align-items: stretch; }
  .td-overview .row { width: 100%; }
  .td-overview .row > .btn { flex: 1 1 100%; justify-content: center; }
  .td-doc { grid-template-columns: 34px minmax(0, 1fr); gap: 10px; }
  .td-ico { width: 34px; height: 42px; }
  .td-actions, .td-pend .td-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .td-more { position: static; }
  .td-more[open] { flex-basis: 100%; order: 9; }
  .td-pop { position: static; width: auto; margin-top: 8px; box-shadow: none; }
  .td-2 { grid-template-columns: minmax(0, 1fr); }
  .td-upload .btn.primary, .td-request-form .btn.primary { justify-self: stretch; justify-content: center; }
}

/* ---------- страница загрузки документов арендатором по ссылке (без входа) */
body.pub { background: var(--bg); }
.pub-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 0 16px 40px; padding-bottom: max(40px, env(safe-area-inset-bottom)); }
.pub-head { position: relative; width: 100%; max-width: 760px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin-bottom: 18px; padding: max(22px, env(safe-area-inset-top)) 2px 14px; border-bottom: 1px solid var(--line-2); }
.pub-head::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 56px; height: 3px; background: var(--brand-red); }
.pub-head .brand-logo { width: 190px; max-width: 48vw; height: auto; }
.pub-org { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--brand-gray); text-align: right; }
.pub-main { width: 100%; max-width: 760px; }
.pub-card { padding: 22px 24px 20px; border-top: 3px solid var(--brand-red); border-radius: 4px; }
.pub-title h1 { font-size: 23px; margin: 2px 0 6px; overflow-wrap: anywhere; }
.pub-title p { margin: 0; }
.pub-msg { margin-top: 14px; white-space: pre-wrap; }
.pub-result { margin-top: 14px; }
.pub-result:empty { display: none; }
.pub-result .flash:last-child { margin-bottom: 0; }
.pub-got { margin: 6px 0 0; padding-left: 18px; }
.pub-got small { color: inherit; opacity: .75; }
.pub-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; }
.pub-item { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color .12s, background .12s; }
.pub-item.drag { border-color: var(--brand-red); background: var(--accent-soft); }
.pub-item.has-files { border-color: color-mix(in srgb, var(--good) 55%, var(--line)); }
.pub-item-head { display: flex; gap: 10px; align-items: flex-start; }
.pub-item-head b { font-size: 14.5px; }
.pub-item-head small { display: block; margin-top: 1px; font-size: 12.5px; color: var(--ink-3); }
.pub-num { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); color: var(--ink-2);
  font-size: 12.5px; font-weight: 700; }
.pub-item.has-files .pub-num { background: var(--good); color: #fff; }
.pub-item .dz-zone { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; padding: 0; border: 0; background: none; cursor: default; gap: 8px; }
.pub-item .dz-zone:hover { background: none; }
.pub-item .dz-zone .btn { gap: 7px; }
.pub-kind { width: 100%; max-width: 420px; height: 36px; }
.dz-hint { font-size: 13px; color: var(--ink-3); }
@media (hover: none) and (pointer: coarse) { .dz-hint { display: none; } }
.pub-limits { margin: 12px 0 0; font-size: 12.5px; }
.pub-progress { display: grid; gap: 6px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.pub-progress[hidden] { display: none; }
.pub-progress .meter > i { background: var(--brand-red); transition: width .2s; }
.pub-send { width: 100%; justify-content: center; margin-top: 14px; padding: 11px 14px; font-size: 15px; }
.pub-note { margin: 14px 0 0; font-size: 12.5px; }
.pub-invalid h1 { font-size: 21px; }
@media (max-width: 600px) {
  .pub-wrap { padding: 0 10px 28px; }
  .pub-card { padding: 16px 14px; }
  .pub-title h1 { font-size: 20px; }
  .pub-item { padding: 12px; }
  .pub-item .dz-zone .btn { flex: 1 1 140px; justify-content: center; padding: 10px 12px; }
  .pub-org { display: none; }
}

/* Контекст компании, проекта и физической площадки - отдельные понятия. */
.portfolio-filter { display:flex; flex-wrap:wrap; gap:12px; align-items:end; margin:0 0 20px; padding:14px 16px; background:var(--card); border:1px solid var(--border); border-radius:12px; }
.portfolio-filter label { display:grid; gap:5px; flex:1 1 210px; font-size:13px; color:var(--muted); }
.portfolio-filter select { width:100%; min-width:0; }
.nav-count { display:inline-flex; align-items:center; justify-content:center; min-width:22px; padding:1px 6px; margin-left:8px; border-radius:12px; background:var(--brand-red); color:#fff; font:600 11px var(--font); }
.bp-bell { position:relative; }
.bp-bell b { position:absolute; top:-3px; right:-5px; min-width:18px; padding:1px 4px; border-radius:10px; background:var(--brand-red); color:#fff; font:600 10px var(--font); text-align:center; }
@media (max-width:600px) { .portfolio-filter { padding:12px; gap:8px; } .portfolio-filter label { flex-basis:100%; } .topbar .ro-badge { display:none; } }
