/* Blackout Portal — оформление в духе GitHub / Mona Sans.
   Тёмная тема по умолчанию (белый логотип), светлая — переключателем в меню профиля. */

/* 0.55.1: шрифты облегчены — только нужные знаки (оригиналы — _claude/fonts-original/).
   Mona Sans: ширина 100% (другую не используем), 308 → 103 КБ. Inter: кириллица отдельным файлом 66 КБ,
   полный Inter подгружается, только если на странице встретился редкий знак. */
@font-face {
  font-family: "Mona Sans";
  src: url("../fonts/MonaSansVF.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
  /* в Mona Sans нет кириллицы — берём из неё только латиницу, цифры и знаки */
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2190-2199, U+2212, U+2215;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-001F, U+007F-009F, U+0100-03FF, U+0530-1FFF, U+2028-202F, U+205F-20BC, U+20BE-2115, U+2117-FFFF;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/InterCyr.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0020, U+00A0, U+00AB, U+00BB, U+0400-052F, U+2010-2027, U+2030-205E, U+20BD, U+2116;
}
@font-face {
  font-family: "Mona Sans Mono";
  src: url("../fonts/MonaSansMonoVF.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F;
}

:root {
  --font: "Mona Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  --mono: "Mona Sans Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --bg: #0d1117;
  --bg-inset: #010409;
  --header: #010409;
  --surface: #151b23;
  --surface-2: #1c2430;
  --hover: #1f2833;
  --border: #30363d;
  --border-muted: #232a33;
  --fg: #e6edf3;
  --fg-muted: #9198a1;
  --fg-subtle: #6e7681;
  --accent: #4493f8;
  --accent-muted: rgba(56, 139, 253, .15);
  --success: #3fb950;
  --success-muted: rgba(46, 160, 67, .15);
  --attention: #d29922;
  --attention-muted: rgba(187, 128, 9, .15);
  --danger: #f85149;
  --danger-muted: rgba(248, 81, 73, .12);
  --done: #ab7df8;
  --done-muted: rgba(171, 125, 248, .15);
  --primary-bg: #f0f6fc;
  --primary-fg: #010409;
  --primary-hover: #ffffff;
  --input: #0d1117;
  --shadow: 0 calc(8px * var(--z)) calc(24px * var(--z)) rgba(1, 4, 9, .6), 0 0 0 1px var(--border);
  --overlay: rgba(1, 4, 9, .6);
  --glow-1: rgba(130, 80, 223, .22);
  --glow-2: rgba(31, 111, 235, .18);
  --logo-filter: none;
  --tab-line: #fd8c73;
  --r: calc(6px * var(--z));
  --r-lg: calc(12px * var(--z));
  --ease: cubic-bezier(.2, .8, .2, 1);
  --z: .9;
  --side-w: calc(232px * var(--z));
  --bnav-h: calc(58px * var(--z));
  --subnav-h: 0px;
  --devband-h: 0px;
  --shell-top: calc(107px * var(--z) + var(--subnav-h) + var(--devband-h));
  --shell-bottom: 0px;
  color-scheme: dark;
}
:root[data-nav="left"], :root[data-nav="right"], :root[data-nav="bottom"] { --shell-top: calc(61px * var(--z) + var(--subnav-h) + var(--devband-h)); }
html.has-subnav { --subnav-h: calc(38px * var(--z) + 1px); }
:root[data-nav="bottom"] { --shell-bottom: var(--bnav-h); }

/* серая тема (GitHub Dark Dimmed) */
:root[data-theme="gray"] {
  --bg: #212830;
  --bg-inset: #151b23;
  --header: #151b23;
  --surface: #262c36;
  --surface-2: #2a313c;
  --hover: #2f3742;
  --border: #3d444d;
  --border-muted: #2f3742;
  --fg: #d1d7e0;
  --fg-muted: #9198a1;
  --fg-subtle: #768390;
  --accent: #478be6;
  --accent-muted: rgba(65, 132, 228, .15);
  --success: #57ab5a;
  --success-muted: rgba(70, 149, 74, .15);
  --attention: #c69026;
  --attention-muted: rgba(174, 124, 20, .15);
  --danger: #e5534b;
  --danger-muted: rgba(229, 83, 75, .12);
  --done: #986ee2;
  --done-muted: rgba(152, 110, 226, .15);
  --primary-bg: #d1d7e0;
  --primary-fg: #151b23;
  --primary-hover: #f0f6fc;
  --input: #1c222b;
  --shadow: 0 calc(8px * var(--z)) calc(24px * var(--z)) rgba(1, 4, 9, .4), 0 0 0 1px var(--border);
  --overlay: rgba(1, 4, 9, .5);
  --glow-1: rgba(152, 110, 226, .18);
  --glow-2: rgba(65, 132, 228, .14);
  --logo-filter: none;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-inset: #f6f8fa;
  --header: #f6f8fa;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --hover: #f3f5f7;
  --border: #d1d9e0;
  --border-muted: #e5e9ed;
  --fg: #1f2328;
  --fg-muted: #59636e;
  --fg-subtle: #818b98;
  --accent: #0969da;
  --accent-muted: rgba(9, 105, 218, .1);
  --success: #1a7f37;
  --success-muted: rgba(26, 127, 55, .1);
  --attention: #9a6700;
  --attention-muted: rgba(154, 103, 0, .1);
  --danger: #d1242f;
  --danger-muted: rgba(209, 36, 47, .08);
  --done: #8250df;
  --done-muted: rgba(130, 80, 223, .1);
  --primary-bg: #1f2328;
  --primary-fg: #ffffff;
  --primary-hover: #000000;
  --input: #ffffff;
  --shadow: 0 calc(8px * var(--z)) calc(24px * var(--z)) rgba(140, 149, 159, .2), 0 0 0 1px var(--border);
  --overlay: rgba(31, 35, 40, .35);
  --glow-1: rgba(130, 80, 223, .10);
  --glow-2: rgba(9, 105, 218, .08);
  --logo-filter: invert(1);
  color-scheme: light;
}

/* ночная тема — для площадки и закулисья: почти чёрный с тёплым красно-янтарным светом, без ярко-белого.
   Включается в Профиль → Интерфейс → «Ночной режим» (всегда или по часам) и Shift+T. Дополнения — web/css/ui-plus.css. */
:root[data-theme="night"] {
  --bg: #0c0605;
  --bg-inset: #070303;
  --header: #070303;
  --surface: #140a08;
  --surface-2: #1b0e0b;
  --hover: #23120e;
  --border: #3b1d16;
  --border-muted: #2a140f;
  --fg: #e3bf9d;
  --fg-muted: #ad8467;
  --fg-subtle: #7d5c48;
  --accent: #f19a3e;
  --accent-muted: rgba(241, 154, 62, .14);
  --success: #a3b65a;
  --success-muted: rgba(163, 182, 90, .13);
  --attention: #e8a63c;
  --attention-muted: rgba(232, 166, 60, .14);
  --danger: #ff6450;
  --danger-muted: rgba(255, 100, 80, .13);
  --done: #d08aa8;
  --done-muted: rgba(208, 138, 168, .13);
  --primary-bg: #c96d2c;
  --primary-fg: #140806;
  --primary-hover: #e0823a;
  --input: #0a0404;
  --shadow: 0 calc(8px * var(--z)) calc(24px * var(--z)) rgba(0, 0, 0, .7), 0 0 0 1px var(--border);
  --overlay: rgba(4, 1, 1, .7);
  --glow-1: rgba(201, 60, 30, .16);
  --glow-2: rgba(241, 154, 62, .10);
  --logo-filter: sepia(1) saturate(2.2) hue-rotate(-18deg) brightness(.82);
  --tab-line: #ff6450;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }  /* 0.48.2: фон и у html — Safari не показывает серое при открытии и прокрутке «с отскоком» */
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: calc(14px * var(--z))/1.5 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: calc(4px * var(--z)); }
::selection { background: var(--accent-muted); }
[hidden] { display: none !important; }
.mono, code, kbd, .num { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--fg-muted); }
.subtle { color: var(--fg-subtle); }
.small { font-size: calc(12px * var(--z)); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; gap: calc(8px * var(--z)); align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: calc(16px * var(--z)); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- шапка ---------- */
.app-header {
  position: sticky; top: 0; z-index: 30;
  background: var(--header);
  border-bottom: 1px solid var(--border-muted);
}
.app-header .bar {
  display: flex; align-items: center; gap: calc(16px * var(--z));
  height: calc(60px * var(--z)); padding: 0 calc(24px * var(--z));
}
.brand { display: flex; align-items: center; gap: calc(12px * var(--z)); flex: none; }
.brand img { height: calc(30px * var(--z)); width: auto; display: block; filter: var(--logo-filter); }
.brand .divider { width: 1px; height: calc(22px * var(--z)); background: var(--border); }
.brand .product { font-weight: 600; font-size: calc(14px * var(--z)); color: var(--fg-muted); letter-spacing: .01em; }
.brand:hover { text-decoration: none; }

.gsearch { position: relative; flex: 0 1 calc(380px * var(--z)); margin-left: auto; }
.gsearch input {
  width: 100%; height: calc(32px * var(--z)); padding: 0 calc(36px * var(--z)) 0 calc(32px * var(--z));
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg); color: var(--fg);
}
.gsearch input::placeholder { color: var(--fg-subtle); }
.gsearch > .icon { position: absolute; left: calc(9px * var(--z)); top: calc(8px * var(--z)); color: var(--fg-subtle); }
.gsearch kbd { position: absolute; right: calc(8px * var(--z)); top: calc(7px * var(--z)); }
.gsearch .results {
  position: absolute; top: calc(38px * var(--z)); left: 0; right: 0; min-width: calc(320px * var(--z));
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow);
  max-height: 70vh; overflow: auto; padding: calc(6px * var(--z));
}
.gsearch .results .sec { padding: calc(8px * var(--z)) calc(10px * var(--z)) calc(4px * var(--z)); font-size: calc(12px * var(--z)); color: var(--fg-subtle); font-weight: 600; }
.gsearch .results a { display: flex; gap: calc(8px * var(--z)); padding: calc(7px * var(--z)) calc(10px * var(--z)); border-radius: var(--r); color: var(--fg); }
.gsearch .results a:hover, .gsearch .results a.on { background: var(--hover); text-decoration: none; }

kbd {
  display: inline-block; padding: 0 calc(5px * var(--z)); font-size: calc(11px * var(--z)); line-height: calc(17px * var(--z));
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: calc(4px * var(--z)); color: var(--fg-muted);
  background: var(--bg-inset);
}

.hbtn {
  position: relative; display: inline-grid; place-items: center;
  width: calc(32px * var(--z)); height: calc(32px * var(--z)); border-radius: var(--r);
  border: 1px solid var(--border); background: transparent; color: var(--fg-muted);
}
.hbtn:hover { color: var(--fg); background: var(--hover); }
.hbtn .dot {
  position: absolute; top: -3px; right: -3px; min-width: calc(16px * var(--z)); height: calc(16px * var(--z)); padding: 0 calc(4px * var(--z));
  border-radius: calc(8px * var(--z)); background: var(--accent); color: #fff; font-size: calc(10px * var(--z)); font-weight: 700; line-height: calc(16px * var(--z));
  border: 2px solid var(--header);
}

.avatar {
  --h: 210;
  display: inline-grid; place-items: center; flex: none;
  width: calc(32px * var(--z)); height: calc(32px * var(--z)); border-radius: 50%;
  background: hsl(var(--h) 45% 32%); color: hsl(var(--h) 80% 88%);
  font-weight: 650; font-size: calc(12px * var(--z)); letter-spacing: .02em; border: 0;
}
:root[data-theme="light"] .avatar { background: hsl(var(--h) 60% 88%); color: hsl(var(--h) 55% 28%); }
.avatar.sm { width: calc(22px * var(--z)); height: calc(22px * var(--z)); font-size: calc(10px * var(--z)); }
.avatar.lg { width: calc(40px * var(--z)); height: calc(40px * var(--z)); font-size: calc(14px * var(--z)); }

/* ---------- навигация (вкладки как у репозитория GitHub) ---------- */
.app-nav { padding: 0 calc(16px * var(--z)); overflow-x: auto; scrollbar-width: none; }
.app-nav::-webkit-scrollbar { display: none; }
.app-nav ul { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; }
.app-nav a {
  position: relative; display: flex; align-items: center; gap: calc(8px * var(--z));
  padding: 0 calc(8px * var(--z)); height: calc(46px * var(--z)); color: var(--fg-muted); white-space: nowrap; font-weight: 500;
}
.app-nav a > span.lbl { padding: calc(4px * var(--z)) 0; }
.app-nav a::before {
  content: ""; position: absolute; inset: calc(7px * var(--z)) 2px; border-radius: var(--r); z-index: -1; transition: background .15s;
}
.app-nav a:hover { color: var(--fg); text-decoration: none; }
.app-nav a:hover::before { background: var(--hover); }
.app-nav a.on { color: var(--fg); font-weight: 600; }
.app-nav a.on::after {
  content: ""; position: absolute; left: calc(8px * var(--z)); right: calc(8px * var(--z)); bottom: -1px; height: 2px; border-radius: 2px;
  background: var(--tab-line);
}
.app-nav a .icon { color: var(--fg-subtle); }
.app-nav a.on .icon { color: var(--fg); }
/* группа разделов («Проекты ▾»): список по наведению (web/js/nav.js), под строкой разделов — строка подразделов */
.app-nav .nav-car { display: inline-flex; margin-left: calc(-3px * var(--z)); opacity: .65; transition: transform .15s; }
.app-nav a:hover .nav-car, .app-nav a.dd-open .nav-car { opacity: 1; }
.app-nav a.dd-open .nav-car { transform: rotate(180deg); }
.app-nav a.dd-open::before { background: var(--hover); }
.app-nav .nav-sub { display: none; list-style: none; margin: 0; padding: 0; }
:root[data-nav="left"] .app-nav .nav-sub, :root[data-nav="right"] .app-nav .nav-sub { display: flex; flex-direction: column; gap: 2px; padding-left: calc(14px * var(--z)); }
:root[data-nav="left"] .app-nav .nav-grp.fold .nav-sub, :root[data-nav="right"] .app-nav .nav-grp.fold .nav-sub { display: none; }
:root[data-nav="left"] .app-nav .nav-car, :root[data-nav="right"] .app-nav .nav-car { margin-left: auto; }
:root[data-nav="left"] .app-nav .counter:not([hidden]) + .nav-car, :root[data-nav="right"] .app-nav .counter:not([hidden]) + .nav-car { margin-left: 4px; }
:root[data-nav="left"] .app-nav .nav-grp.fold .nav-car, :root[data-nav="right"] .app-nav .nav-grp.fold .nav-car { transform: rotate(-90deg); }
:root[data-nav="left"] .app-nav .nav-grp:not(.fold) > a.on::before, :root[data-nav="right"] .app-nav .nav-grp:not(.fold) > a.on::before { background: none; }
:root[data-nav="left"] .app-nav .nav-grp:not(.fold) > a.on::after, :root[data-nav="right"] .app-nav .nav-grp:not(.fold) > a.on::after { display: none; }
:root[data-nav="bottom"] .app-nav .nav-car { display: none; }
.menu.nav-dd { position: fixed; z-index: 60; min-width: calc(200px * var(--z)); padding: calc(4px * var(--z)); }
.menu.nav-dd a { gap: calc(8px * var(--z)); padding: calc(6px * var(--z)) calc(9px * var(--z)); font-size: calc(13.5px * var(--z)); }
.menu.nav-dd a .grow { flex: 1; min-width: 0; white-space: nowrap; }
.menu.nav-dd a .icon { color: var(--fg-muted); flex: none; }
.menu.nav-dd a.on { background: var(--accent-muted); font-weight: 600; }
.menu.nav-dd a.on .icon { color: var(--accent); }
.menu.nav-dd a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.menu.nav-dd kbd { margin-left: 10px; white-space: nowrap; flex: none; font-size: calc(10.5px * var(--z)); opacity: .8; }
.app-subnav { border-top: 1px solid var(--border-muted); padding: 0 calc(16px * var(--z)); overflow-x: auto; scrollbar-width: none;
  background: color-mix(in srgb, var(--bg) 40%, var(--header)); }
.app-subnav::-webkit-scrollbar { display: none; }
.app-subnav[hidden] { display: none; }
.app-subnav ul { display: flex; align-items: center; gap: 2px; height: calc(38px * var(--z)); list-style: none; margin: 0; padding: 0; }
.app-subnav a { display: flex; align-items: center; gap: calc(6px * var(--z)); height: calc(28px * var(--z)); padding: 0 calc(11px * var(--z)); border-radius: 999px;
  color: var(--fg-muted); font-size: calc(13px * var(--z)); font-weight: 500; white-space: nowrap; }
.app-subnav a:hover { background: var(--hover); color: var(--fg); text-decoration: none; }
.app-subnav a .icon { color: var(--fg-subtle); }
.app-subnav a.on { background: var(--accent-muted); color: var(--fg); font-weight: 600; }
.app-subnav a.on .icon { color: var(--accent); }
:root[data-nav="left"] .app-subnav, :root[data-nav="right"] .app-subnav { display: none !important; }
.counter {
  display: inline-block; min-width: calc(20px * var(--z)); padding: 0 calc(6px * var(--z)); border-radius: 2em;
  background: var(--surface-2); color: var(--fg); font-size: calc(12px * var(--z)); font-weight: 600; line-height: calc(18px * var(--z)); text-align: center;
  border: 1px solid var(--border-muted);
}
.counter.blue { background: var(--accent); color: #fff; border-color: transparent; }

/* ---------- раскладка страницы ---------- */
main#view { max-width: calc(1280px * var(--z)); margin: 0 auto; padding: calc(24px * var(--z)) calc(24px * var(--z)) calc(80px * var(--z)); }
main#view.wide { max-width: none; }
main#view.flush { padding: 0; max-width: none; }
.page-enter { animation: pageIn .26s var(--ease); }
@keyframes pageIn { from { opacity: 0; transform: translateY(calc(6px * var(--z))); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; gap: calc(16px * var(--z)); flex-wrap: wrap; margin-bottom: calc(20px * var(--z)); }
.page-head h1 { margin: 0; font-size: calc(24px * var(--z)); line-height: 1.25; font-weight: 650; letter-spacing: -.015em; }
.page-head .sub { color: var(--fg-muted); margin-top: calc(4px * var(--z)); }
.page-head .actions { margin-left: auto; display: flex; gap: calc(8px * var(--z)); flex-wrap: wrap; }
.crumbs { display: flex; gap: calc(6px * var(--z)); align-items: center; color: var(--fg-muted); font-size: calc(13px * var(--z)); margin-bottom: calc(8px * var(--z)); flex-wrap: wrap; }
.crumbs a { color: var(--fg-muted); }
.crumbs a:hover { color: var(--accent); }

h2 { font-size: calc(16px * var(--z)); font-weight: 650; margin: 0; letter-spacing: -.005em; }
h3 { font-size: calc(14px * var(--z)); font-weight: 650; margin: 0; }

.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) calc(300px * var(--z)); gap: calc(24px * var(--z)); align-items: start; }
.layout-side > * { min-width: 0; }
.layout-side > aside { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1400px) { .layout-side { grid-template-columns: minmax(0, 1fr) calc(360px * var(--z)); } }
.layout-side > aside { position: sticky; top: calc(var(--shell-top) + calc(23px * var(--z))); display: grid; gap: calc(16px * var(--z)); }
@media (max-width: 1000px) { .layout-side { grid-template-columns: 1fr; } .layout-side > aside { position: static; } }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: calc(6px * var(--z));
  height: calc(32px * var(--z)); padding: 0 calc(12px * var(--z)); border-radius: var(--r);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--fg);
  font-weight: 500; font-size: calc(14px * var(--z)); white-space: nowrap; text-decoration: none !important;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--hover); border-color: var(--fg-subtle); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary-bg); color: var(--primary-fg); border-color: transparent; font-weight: 600; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.green { background: #238636; color: #fff; border-color: rgba(240,246,252,.1); font-weight: 600; }
.btn.green:hover { background: #2ea043; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--fg-muted); }
.btn.ghost:hover { background: var(--hover); color: var(--fg); }
.btn.sm { height: calc(28px * var(--z)); padding: 0 calc(10px * var(--z)); font-size: calc(12px * var(--z)); }
.btn.icon-only { width: calc(32px * var(--z)); padding: 0; }
.btn.sm.icon-only { width: calc(28px * var(--z)); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn .icon { flex: none; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r) 0 0 var(--r); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--r) var(--r) 0; }
.btn-group .btn.on { background: var(--accent-muted); color: var(--accent); border-color: var(--accent); z-index: 1; }

.icon { display: inline-block; vertical-align: text-bottom; flex: none; }

/* ---------- блоки ---------- */
.box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.box-head {
  display: flex; align-items: center; gap: calc(10px * var(--z)); padding: calc(12px * var(--z)) calc(16px * var(--z));
  background: var(--surface-2); border-bottom: 1px solid var(--border); border-radius: var(--r) var(--r) 0 0;
}
.box-head h2, .box-head h3 { flex: 1; }
.box-body { padding: calc(16px * var(--z)); }
.box-row { display: flex; align-items: center; gap: calc(12px * var(--z)); padding: calc(10px * var(--z)) calc(16px * var(--z)); border-top: 1px solid var(--border-muted); }
.box-row:first-child { border-top: 0; }
a.box-row { color: inherit; }
a.box-row:hover { background: var(--hover); text-decoration: none; }
.box-foot { padding: calc(10px * var(--z)) calc(16px * var(--z)); border-top: 1px solid var(--border-muted); }

.blank {
  display: grid; justify-items: center; gap: calc(8px * var(--z)); text-align: center;
  padding: calc(48px * var(--z)) calc(24px * var(--z)); color: var(--fg-muted);
}
.blank .icon { color: var(--fg-subtle); margin-bottom: calc(4px * var(--z)); }
.blank strong { color: var(--fg); font-size: calc(16px * var(--z)); font-weight: 600; }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
table.t { width: 100%; border-collapse: collapse; }
.t th, .t td { padding: calc(var(--cell-y, 9px) * var(--z)) calc(var(--cell-x, 14px) * var(--z)); text-align: left; border-top: 1px solid var(--border-muted); vertical-align: middle; }
.t thead th {
  border-top: 0; background: var(--surface-2); color: var(--fg-muted);
  font-size: calc(12px * var(--z)); font-weight: 600; white-space: nowrap; position: sticky; top: 0;
}
.t th.sortable { cursor: pointer; user-select: none; }
.t th.sortable:hover { color: var(--fg); }
.t tbody tr { transition: background .1s; }
.t tbody tr.link { cursor: pointer; }
.t tbody tr.link:hover { background: var(--hover); }
.t td.num, .t th.num { text-align: right; }
.t th.num { font-family: var(--font); }
.t .title { font-weight: 600; color: var(--fg); }
.t .title:hover { color: var(--accent); }
.t tfoot td { background: var(--surface-2); font-weight: 650; border-top: 1px solid var(--border); }

/* ---------- метки статусов ---------- */
.label {
  display: inline-flex; align-items: center; gap: calc(4px * var(--z));
  padding: 0 calc(8px * var(--z)); height: calc(22px * var(--z)); border-radius: 2em; border: 1px solid var(--border);
  font-size: calc(12px * var(--z)); font-weight: 500; white-space: nowrap; color: var(--fg-muted);
}
.label.draft { color: var(--fg-muted); }
.label.submitted { color: var(--attention); border-color: currentColor; background: var(--attention-muted); }
.label.returned { color: var(--danger); border-color: currentColor; background: var(--danger-muted); }
.label.approved { color: var(--success); border-color: currentColor; background: var(--success-muted); }
.label.closed { color: #fff; border-color: var(--success); background: var(--success); }
.label.canceled { color: var(--fg-subtle); text-decoration: line-through; }
.label.blue { color: var(--accent); border-color: currentColor; background: var(--accent-muted); }
.label.purple { color: var(--done); border-color: currentColor; background: var(--done-muted); }
.label.green { color: var(--success); border-color: currentColor; background: var(--success-muted); }
.label.solid-green { background: #238636; color: #fff; border-color: transparent; font-weight: 650; text-transform: uppercase; font-size: calc(11px * var(--z)); letter-spacing: .03em; }
.label.urgent { background: var(--danger); color: #fff; border-color: transparent; font-weight: 700; }
.tag { display: inline-block; padding: 0 calc(7px * var(--z)); border-radius: 2em; font-size: calc(12px * var(--z)); line-height: calc(20px * var(--z)); background: var(--accent-muted); color: var(--accent); white-space: nowrap; }

/* ---------- формы ---------- */
.input, .select, textarea.input {
  width: 100%; height: calc(32px * var(--z)); padding: 0 calc(10px * var(--z));
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--input); color: var(--fg); transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: calc(64px * var(--z)); padding: calc(7px * var(--z)) calc(10px * var(--z)); resize: vertical; line-height: 1.45; }
.select { padding-right: calc(28px * var(--z)); appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238b949e' stroke-width='1.6'%3E%3Cpath d='m4.5 6.5 3.5 3.5 3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right calc(7px * var(--z)) center; }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 calc(3px * var(--z)) var(--accent-muted); }
.input::placeholder, textarea.input::placeholder { color: var(--fg-subtle); }
.input[readonly], .input:disabled, .select:disabled, textarea.input[readonly] { background: var(--bg-inset); color: var(--fg-muted); }
.input.num { text-align: right; }
.input.invalid, .select.invalid { border-color: var(--danger); }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: calc(9px * var(--z)); top: calc(8px * var(--z)); color: var(--fg-subtle); pointer-events: none; }
.input-icon > .input { padding-left: calc(32px * var(--z)); }

.field { display: grid; gap: calc(6px * var(--z)); min-width: 0; align-content: start; }
.field > label, .field > .lbl { font-weight: 600; font-size: calc(13px * var(--z)); }
.field .hint { color: var(--fg-muted); font-size: calc(12px * var(--z)); }
.field .req::after { content: " *"; color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: calc(16px * var(--z)); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(16px * var(--z)); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: calc(16px * var(--z)); }
@media (max-width: 860px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
@media (max-width: 560px) { .span-2 { grid-column: auto; } }
.check { display: inline-flex; align-items: center; gap: calc(8px * var(--z)); cursor: pointer; }
.check input { width: calc(16px * var(--z)); height: calc(16px * var(--z)); accent-color: var(--accent); margin: 0; }
.section-title {
  display: flex; align-items: center; gap: calc(10px * var(--z)); margin: calc(8px * var(--z)) 0 -4px;
  font-size: calc(12px * var(--z)); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-muted);
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border-muted); }

.toolbar { display: flex; gap: calc(8px * var(--z)); align-items: center; flex-wrap: wrap; margin-bottom: calc(16px * var(--z)); }
.toolbar .input-icon { flex: 1 1 calc(260px * var(--z)); max-width: calc(420px * var(--z)); }
.toolbar .select { width: auto; min-width: calc(140px * var(--z)); }

/* подчёркнутые вкладки внутри страницы */
.tabs { display: flex; gap: calc(4px * var(--z)); border-bottom: 1px solid var(--border-muted); margin-bottom: calc(16px * var(--z)); overflow-x: auto; }
.tabs button {
  position: relative; border: 0; background: none; padding: calc(8px * var(--z)) calc(12px * var(--z)) calc(10px * var(--z)); color: var(--fg-muted); font-weight: 500; white-space: nowrap;
  display: inline-flex; gap: calc(6px * var(--z)); align-items: center;
}
.tabs button:hover { color: var(--fg); }
.tabs button.on { color: var(--fg); font-weight: 600; }
.tabs button.on::after { content: ""; position: absolute; left: calc(8px * var(--z)); right: calc(8px * var(--z)); bottom: -1px; height: 2px; background: var(--tab-line); border-radius: 2px; }

/* список «ключ — значение» */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(220px * var(--z)), 1fr)); gap: calc(18px * var(--z)) calc(24px * var(--z)); }
.kv .k { font-size: calc(11px * var(--z)); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-subtle); margin-bottom: calc(4px * var(--z)); }
.kv .v { color: var(--fg); overflow-wrap: anywhere; }
dl.dl { display: grid; grid-template-columns: minmax(calc(120px * var(--z)), 38%) 1fr; margin: 0; }
dl.dl dt, dl.dl dd { margin: 0; padding: calc(8px * var(--z)) 0; border-top: 1px solid var(--border-muted); }
dl.dl dt { color: var(--fg-muted); padding-right: calc(12px * var(--z)); }
dl.dl dd { overflow-wrap: anywhere; }
dl.dl > :nth-child(-n+2) { border-top: 0; }

/* ---------- всплывающие окна ---------- */
.modal-root { position: fixed; inset: 0; z-index: 100; display: grid; place-items: start center; padding: 6vh calc(16px * var(--z)) calc(16px * var(--z)); overflow: auto;
  background: var(--overlay); backdrop-filter: blur(calc(3px * var(--z))); animation: fadeIn .15s ease; }
.modal { width: min(calc(560px * var(--z)), 100%); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); animation: popIn .2s var(--ease); }
.modal.wide { width: min(calc(880px * var(--z)), 100%); }
.modal.xwide { width: min(calc(1120px * var(--z)), 100%); }
.modal-head { display: flex; align-items: center; gap: calc(10px * var(--z)); padding: calc(16px * var(--z)) calc(16px * var(--z)) calc(12px * var(--z)) calc(20px * var(--z)); border-bottom: 1px solid var(--border-muted); }
.modal-head h2 { flex: 1; font-size: calc(16px * var(--z)); }
.modal-body { padding: calc(20px * var(--z)); display: grid; gap: calc(16px * var(--z)); }
.modal-foot { display: flex; justify-content: flex-end; gap: calc(8px * var(--z)); padding: calc(12px * var(--z)) calc(20px * var(--z)) calc(16px * var(--z)); border-top: 1px solid var(--border-muted); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; display: flex; gap: calc(8px * var(--z)); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(calc(8px * var(--z))) scale(.985); } }

.menu { position: absolute; z-index: 60; min-width: calc(220px * var(--z)); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: calc(6px * var(--z)); animation: popIn .14s var(--ease); }
.menu a, .menu button { display: flex; align-items: center; gap: calc(8px * var(--z)); width: 100%; padding: calc(7px * var(--z)) calc(10px * var(--z)); border: 0; border-radius: var(--r); background: none; color: var(--fg); text-align: left; }
.menu a:hover, .menu button:hover { background: var(--hover); text-decoration: none; }
.menu hr { border: 0; border-top: 1px solid var(--border-muted); margin: calc(6px * var(--z)) 0; }
.menu .head { padding: calc(8px * var(--z)) calc(10px * var(--z)); }

.update-banner { position: fixed; right: calc(20px * var(--z)); bottom: calc(20px * var(--z)); z-index: 150; display: flex; align-items: center; gap: calc(12px * var(--z)); padding: calc(10px * var(--z)) calc(10px * var(--z)) calc(10px * var(--z)) calc(16px * var(--z));
  border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow); font-weight: 500; animation: popIn .25s var(--ease); }
.update-banner .icon { color: var(--done); }
.toasts { position: fixed; bottom: calc(20px * var(--z)); left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: calc(8px * var(--z)); justify-items: center; pointer-events: none; }
.toast { background: var(--fg); color: var(--bg); padding: calc(9px * var(--z)) calc(16px * var(--z)); border-radius: var(--r); font-weight: 500; box-shadow: var(--shadow); animation: popIn .2s var(--ease); max-width: 90vw; }
.toast.error { background: var(--danger); color: #fff; }

.notice { display: flex; gap: calc(10px * var(--z)); align-items: flex-start; padding: calc(12px * var(--z)) calc(16px * var(--z)); border-radius: var(--r); border: 1px solid; }
.notice.info { border-color: rgba(56,139,253,.4); background: var(--accent-muted); }
.notice.warn { border-color: rgba(187,128,9,.4); background: var(--attention-muted); }
.notice.error { border-color: rgba(248,81,73,.4); background: var(--danger-muted); }
.notice.ok { border-color: rgba(46,160,67,.4); background: var(--success-muted); }
.notice ul { margin: calc(4px * var(--z)) 0 0; padding-left: calc(18px * var(--z)); }

.spinner { width: calc(18px * var(--z)); height: calc(18px * var(--z)); border: 2px solid var(--border); border-top-color: var(--fg-muted); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: calc(60px * var(--z)); }

/* ---------- вход ---------- */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: calc(24px * var(--z));
  background:
    radial-gradient(calc(900px * var(--z)) calc(500px * var(--z)) at 15% -10%, var(--glow-1), transparent 60%),
    radial-gradient(calc(800px * var(--z)) calc(500px * var(--z)) at 100% 0%, var(--glow-2), transparent 60%),
    var(--bg-inset);
}
.auth-card { width: min(calc(380px * var(--z)), 100%); }
.auth-card .logo { display: block; width: calc(210px * var(--z)); margin: 0 auto calc(28px * var(--z)); filter: var(--logo-filter); }
.auth-card h1 { font-size: calc(22px * var(--z)); font-weight: 600; text-align: center; margin: 0 0 calc(18px * var(--z)); letter-spacing: -.01em; }
.auth-card .box { padding: calc(20px * var(--z)); display: grid; gap: calc(16px * var(--z)); border-radius: var(--r-lg); }
.auth-card .foot { text-align: center; color: var(--fg-subtle); font-size: calc(12px * var(--z)); margin-top: calc(20px * var(--z)); }

/* ---------- главная ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: var(--r-lg); border: 1px solid var(--border-muted);
  padding: calc(36px * var(--z)) calc(32px * var(--z)); margin-bottom: calc(24px * var(--z));
  background:
    radial-gradient(calc(700px * var(--z)) calc(300px * var(--z)) at 0% 0%, var(--glow-1), transparent 70%),
    radial-gradient(calc(600px * var(--z)) calc(300px * var(--z)) at 100% 100%, var(--glow-2), transparent 70%),
    var(--bg-inset);
}
.hero h1 { margin: 0; font-size: calc(34px * var(--z)); line-height: 1.12; font-weight: 700; letter-spacing: -.025em; }
.hero p { margin: calc(10px * var(--z)) 0 0; color: var(--fg-muted); font-size: calc(16px * var(--z)); max-width: calc(640px * var(--z)); }
.hero .mark { position: absolute; right: -40px; top: -40px; width: calc(260px * var(--z)); opacity: .07; filter: var(--logo-filter); pointer-events: none; }

.timeline { position: relative; padding-left: calc(28px * var(--z)); }
.timeline::before { content: ""; position: absolute; left: calc(11px * var(--z)); top: calc(6px * var(--z)); bottom: calc(6px * var(--z)); width: 2px; background: var(--border-muted); }
.tl-item { position: relative; padding-bottom: calc(22px * var(--z)); }
.tl-item .node { position: absolute; left: -28px; top: 2px; width: calc(24px * var(--z)); height: calc(24px * var(--z)); border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); border: 2px solid var(--bg); color: var(--fg-muted); }
.tl-item .node.release { background: var(--done); color: #fff; }
.tl-item .node.feature { background: #238636; color: #fff; }
.tl-item .node.fix { background: var(--attention); color: #fff; }
.tl-item .meta { display: flex; gap: calc(8px * var(--z)); align-items: center; flex-wrap: wrap; color: var(--fg-muted); font-size: calc(12px * var(--z)); }
.tl-item h3 { font-size: calc(16px * var(--z)); margin: calc(4px * var(--z)) 0 calc(6px * var(--z)); }
.tl-item .body { color: var(--fg); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(calc(160px * var(--z)), 1fr)); gap: calc(12px * var(--z)); }
.stat { padding: calc(14px * var(--z)) calc(16px * var(--z)); }
.stat .v { font-size: calc(26px * var(--z)); font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .k { color: var(--fg-muted); font-size: calc(12px * var(--z)); }

/* ---------- markdown ---------- */
.md { line-height: 1.65; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1 { font-size: calc(26px * var(--z)); margin: calc(28px * var(--z)) 0 calc(12px * var(--z)); font-weight: 700; letter-spacing: -.02em; }
.md h2 { font-size: calc(20px * var(--z)); margin: calc(26px * var(--z)) 0 calc(10px * var(--z)); padding-bottom: calc(6px * var(--z)); border-bottom: 1px solid var(--border-muted); }
.md h3 { font-size: calc(16px * var(--z)); margin: calc(22px * var(--z)) 0 calc(8px * var(--z)); }
.md p { margin: 0 0 calc(12px * var(--z)); }
.md ul, .md ol { margin: 0 0 calc(12px * var(--z)); padding-left: calc(24px * var(--z)); }
.md li { margin: calc(3px * var(--z)) 0; }
.md li.task { list-style: none; margin-left: -20px; }
.md li.task input { margin-right: calc(6px * var(--z)); accent-color: var(--accent); }
.md code { padding: .15em .4em; border-radius: calc(6px * var(--z)); background: var(--surface-2); font-size: 85%; }
.md pre { padding: calc(14px * var(--z)) calc(16px * var(--z)); border-radius: var(--r); background: var(--bg-inset); border: 1px solid var(--border-muted); overflow: auto; }
.md pre code { padding: 0; background: none; }
.md blockquote { margin: 0 0 calc(12px * var(--z)); padding: 2px calc(14px * var(--z)); border-left: calc(3px * var(--z)) solid var(--border); color: var(--fg-muted); }
.md .callout { display: flex; gap: calc(10px * var(--z)); margin: 0 0 calc(12px * var(--z)); padding: calc(12px * var(--z)) calc(14px * var(--z)); border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border-muted); color: var(--fg); }
.md .callout .ci { font-size: calc(18px * var(--z)); line-height: 1.3; }
.md hr { border: 0; border-top: 1px solid var(--border-muted); margin: calc(20px * var(--z)) 0; }
.md table { border-collapse: collapse; margin: 0 0 calc(12px * var(--z)); display: block; overflow: auto; }
.md th, .md td { border: 1px solid var(--border); padding: calc(6px * var(--z)) calc(12px * var(--z)); }
.md th { background: var(--surface-2); font-weight: 600; }
.md img { border-radius: var(--r); border: 1px solid var(--border-muted); }
.md kbd { font-size: calc(12px * var(--z)); }

.mention { display: inline-block; padding: 0 calc(4px * var(--z)); border-radius: calc(4px * var(--z)); background: var(--accent-muted); color: var(--accent); font-weight: 600; }
.mention.me { background: var(--attention-muted); color: var(--attention); }
.ptag { display: inline-flex; align-items: center; gap: calc(3px * var(--z)); padding: 0 calc(6px * var(--z)); border-radius: calc(4px * var(--z)); background: var(--done-muted); color: var(--done); font-weight: 600; }
.ptag:hover { text-decoration: none; filter: brightness(1.15); }

/* ---------- заявки ---------- */
.req-total { display: flex; gap: calc(24px * var(--z)); flex-wrap: wrap; }
.req-total .v { font-size: calc(22px * var(--z)); font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.req-total .k { color: var(--fg-muted); font-size: calc(12px * var(--z)); }
.stage-table { width: 100%; border-collapse: collapse; }
.stage-table th, .stage-table td { padding: calc(6px * var(--z)); text-align: left; }
.stage-table th { font-size: calc(12px * var(--z)); color: var(--fg-muted); font-weight: 600; }
.stage-table td:first-child { font-weight: 600; white-space: nowrap; padding-right: calc(12px * var(--z)); }
.stage-table .input { min-width: calc(112px * var(--z)); }
.money-table td { padding: calc(6px * var(--z)) calc(8px * var(--z)); }
.money-table .input { min-width: calc(120px * var(--z)); }
.money-table td:first-child { font-weight: 600; }
.line-card { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); padding: calc(14px * var(--z)) calc(14px * var(--z)) calc(14px * var(--z)) calc(46px * var(--z)); position: relative; display: grid; gap: calc(12px * var(--z)); animation: pageIn .2s var(--ease); }
.line-card .n { position: absolute; left: calc(12px * var(--z)); top: calc(14px * var(--z)); width: calc(24px * var(--z)); height: calc(24px * var(--z)); border-radius: 50%; display: grid; place-items: center; font-size: calc(12px * var(--z)); font-weight: 650; background: var(--surface-2); color: var(--fg-muted); }
.line-card .rm { position: absolute; right: calc(8px * var(--z)); top: calc(8px * var(--z)); }
.log { display: grid; gap: 0; }
.log .it { display: flex; gap: calc(10px * var(--z)); padding: calc(10px * var(--z)) 0; border-top: 1px solid var(--border-muted); }
.log .it:first-child { border-top: 0; }
.log .it .c { margin-top: calc(4px * var(--z)); padding: calc(8px * var(--z)) calc(10px * var(--z)); border-radius: var(--r); background: var(--surface-2); white-space: pre-wrap; }

/* ---------- чат ---------- */
.chat { display: grid; grid-template-columns: calc(260px * var(--z)) minmax(0, 1fr); height: calc(100vh - var(--shell-top) - var(--shell-bottom)); border-top: 0; }
.chat-side { border-right: 1px solid var(--border-muted); background: var(--bg-inset); overflow: auto; padding: calc(12px * var(--z)) calc(8px * var(--z)); }
.chat-side .grp { padding: calc(10px * var(--z)) calc(10px * var(--z)) calc(4px * var(--z)); font-size: calc(12px * var(--z)); font-weight: 650; color: var(--fg-subtle); display: flex; align-items: center; }
.chat-side .grp button { margin-left: auto; }
.chat-side a { display: flex; align-items: center; gap: calc(8px * var(--z)); padding: calc(6px * var(--z)) calc(10px * var(--z)); border-radius: var(--r); color: var(--fg-muted); }
.chat-side a:hover { background: var(--hover); text-decoration: none; color: var(--fg); }
.chat-side a.on { background: var(--surface-2); color: var(--fg); font-weight: 600; }
.chat-side a.unread { color: var(--fg); font-weight: 650; }
.chat-side a .counter { margin-left: auto; }
.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-main > .chat-feed { flex: 1 1 auto; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: calc(10px * var(--z)); padding: calc(12px * var(--z)) calc(20px * var(--z)); border-bottom: 1px solid var(--border-muted); }
.chat-head h2 { font-size: calc(16px * var(--z)); }
.chat-feed { overflow: auto; padding: calc(16px * var(--z)) calc(20px * var(--z)); display: flex; flex-direction: column; }
/* сообщения не сжимаются, когда лента длиннее окна (иначе стикеры и длинные сообщения наезжают друг на друга) */
.chat-feed > * { flex-shrink: 0; }
.msg { display: grid; grid-template-columns: calc(36px * var(--z)) minmax(0, 1fr); gap: calc(10px * var(--z)); padding: calc(6px * var(--z)) calc(8px * var(--z)); border-radius: var(--r); position: relative; }
.msg:hover { background: var(--hover); }
.msg.cont { padding-top: 1px; padding-bottom: 1px; }
.msg.cont .avatar { visibility: hidden; height: 0; }
.msg .who { display: flex; gap: calc(8px * var(--z)); align-items: baseline; }
.msg .who b { font-weight: 650; }
.msg .who time { color: var(--fg-subtle); font-size: calc(12px * var(--z)); }
.msg .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .text.deleted { color: var(--fg-subtle); font-style: italic; }
.msg .tools { position: absolute; right: calc(8px * var(--z)); top: -10px; display: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 2px; }
.msg:hover .tools { display: flex; }
.msg.mentioned { background: var(--attention-muted); box-shadow: inset 2px 0 0 var(--attention); }
.day-sep { display: flex; align-items: center; gap: calc(12px * var(--z)); color: var(--fg-subtle); font-size: calc(12px * var(--z)); font-weight: 600; margin: calc(14px * var(--z)) 0 calc(6px * var(--z)); }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--border-muted); }
.composer { padding: calc(12px * var(--z)) calc(20px * var(--z)) calc(18px * var(--z)); position: relative; }
.composer .wrap { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--input); display: flex; align-items: flex-end; gap: calc(6px * var(--z)); padding: calc(6px * var(--z)) calc(6px * var(--z)) calc(6px * var(--z)) calc(12px * var(--z)); }
.composer .wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 calc(3px * var(--z)) var(--accent-muted); }
.composer textarea { flex: 1; border: 0; background: none; resize: none; padding: calc(6px * var(--z)) 0; max-height: calc(180px * var(--z)); line-height: 1.45; outline: none; }
.composer .hint { color: var(--fg-subtle); font-size: calc(12px * var(--z)); margin-top: calc(6px * var(--z)); }
.suggest { position: absolute; bottom: calc(100% - calc(6px * var(--z))); left: calc(20px * var(--z)); width: min(calc(380px * var(--z)), calc(100% - calc(40px * var(--z)))); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: calc(6px * var(--z)); z-index: 20; }
.suggest button { display: flex; gap: calc(8px * var(--z)); align-items: center; width: 100%; padding: calc(6px * var(--z)) calc(8px * var(--z)); border: 0; background: none; border-radius: var(--r); text-align: left; color: var(--fg); }
.suggest button.on, .suggest button:hover { background: var(--hover); }
/* папки проектов и игра «Дуэль» */
.chat-side .grp-toggle { width: 100%; border: 0; background: none; gap: calc(4px * var(--z)); cursor: pointer; margin-top: calc(4px * var(--z)); text-align: left; }
.chat-side .grp-toggle:hover { color: var(--fg); }
.pfolder-head { display: flex; align-items: center; gap: calc(6px * var(--z)); width: 100%; padding: calc(6px * var(--z)) calc(8px * var(--z)); border: 0; background: none; border-radius: var(--r); color: var(--fg-muted); text-align: left; cursor: pointer; font-size: calc(13px * var(--z)); }
.pfolder-head:hover { background: var(--hover); color: var(--fg); }
.pfolder-head.unread { color: var(--fg); font-weight: 650; }
.pfolder-head .counter { margin-left: auto; }
.pfolder-head > .ellipsis { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.pfolder-head > .icon { flex: none; }
.pfolder.open > .pfolder-head { color: var(--fg); }
.pfolder-body { margin-left: calc(15px * var(--z)); padding-left: calc(6px * var(--z)); border-left: 1px solid var(--border-muted); }
.chat-side a.sub { padding: calc(4px * var(--z)) calc(10px * var(--z)); font-size: calc(13px * var(--z)); }
.input.sm { height: calc(28px * var(--z)); padding: calc(3px * var(--z)) calc(8px * var(--z)); font-size: calc(13px * var(--z)); }
.chat-pin { display: flex; align-items: center; gap: calc(8px * var(--z)); padding: calc(7px * var(--z)) calc(20px * var(--z)); border-bottom: 1px solid var(--border-muted); background: var(--surface-2); font-size: calc(13px * var(--z)); flex-wrap: wrap; }
.chat-pin a { display: inline-flex; align-items: center; gap: calc(4px * var(--z)); font-weight: 600; }
.msg-sys { display: flex; justify-content: center; align-items: baseline; gap: calc(8px * var(--z)); margin: calc(6px * var(--z)) 0; color: var(--fg-muted); font-size: calc(13px * var(--z)); text-align: center; }
.msg-sys .text { background: var(--surface-2); border: 1px solid var(--border-muted); border-radius: calc(999px * var(--z)); padding: calc(4px * var(--z)) calc(14px * var(--z)); }
.msg-sys time { color: var(--fg-subtle); font-size: calc(11px * var(--z)); }
.duel-card { margin-top: calc(4px * var(--z)); border: 1px solid var(--border); border-radius: var(--r-lg); padding: calc(10px * var(--z)) calc(14px * var(--z)); max-width: calc(460px * var(--z)); background: var(--surface); display: grid; gap: calc(8px * var(--z)); justify-items: start; }
.duel-card.pending { border-color: var(--accent); box-shadow: inset calc(3px * var(--z)) 0 0 var(--accent); }
.duel-card.done { box-shadow: inset calc(3px * var(--z)) 0 0 var(--success); }
.duel-vs { display: flex; align-items: center; gap: calc(8px * var(--z)); }
.duel-moves { display: flex; gap: calc(8px * var(--z)); flex-wrap: wrap; }
.duel-moves .btn { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; height: auto; padding: calc(8px * var(--z)) calc(14px * var(--z)); min-width: calc(84px * var(--z)); }
.duel-emoji { font-size: calc(24px * var(--z)); line-height: 1.1; display: block; }
.duel-pick { cursor: pointer; }
.duel-pick input { position: absolute; opacity: 0; pointer-events: none; }
.duel-pick > span { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: calc(8px * var(--z)) calc(14px * var(--z)); min-width: calc(84px * var(--z)); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
.duel-pick input:checked + span { border-color: var(--accent); background: var(--accent-muted); box-shadow: 0 0 0 1px var(--accent); }
.duel-pick input:focus-visible + span { outline: 2px solid var(--accent); }
.duel-res { display: flex; gap: 2px calc(16px * var(--z)); flex-wrap: wrap; }
.t tr.me-row td { background: var(--accent-muted); }
@media (max-width: 760px) { .chat { grid-template-columns: 1fr; } .chat-side { display: none; } .chat.show-side .chat-side { display: block; } }

/* ---------- база знаний ---------- */
.kb { display: grid; grid-template-columns: calc(280px * var(--z)) minmax(0, 1fr); min-height: calc(100vh - var(--shell-top) - var(--shell-bottom)); }
.kb-side { border-right: 1px solid var(--border-muted); background: var(--bg-inset); padding: calc(12px * var(--z)) calc(8px * var(--z)); overflow: auto; position: sticky; top: var(--shell-top); height: calc(100vh - var(--shell-top) - var(--shell-bottom)); }
.kb-side .top { display: flex; gap: calc(6px * var(--z)); padding: 0 calc(4px * var(--z)) calc(10px * var(--z)); }
.kb-tree { list-style: none; margin: 0; padding: 0; }
.kb-tree ul { list-style: none; margin: 0; padding-left: calc(14px * var(--z)); }
.kb-tree .node { display: flex; align-items: center; gap: 2px; border-radius: var(--r); }
.kb-tree .node:hover { background: var(--hover); }
.kb-tree .node.on { background: var(--surface-2); }
.kb-tree .node a { flex: 1; display: flex; gap: calc(6px * var(--z)); align-items: center; padding: calc(5px * var(--z)) calc(6px * var(--z)); color: var(--fg-muted); min-width: 0; }
.kb-tree .node.on a { color: var(--fg); font-weight: 600; }
.kb-tree .node a:hover { text-decoration: none; color: var(--fg); }
.kb-tree .tw { width: calc(20px * var(--z)); height: calc(20px * var(--z)); border: 0; background: none; color: var(--fg-subtle); display: grid; place-items: center; border-radius: calc(4px * var(--z)); padding: 0; }
.kb-tree .tw:hover { background: var(--border-muted); }
.kb-tree .tw.leaf { visibility: hidden; }
.kb-tree .add { opacity: 0; }
.kb-tree .node:hover .add { opacity: 1; }
.kb-page { max-width: calc(860px * var(--z)); width: 100%; margin: 0 auto; padding: calc(40px * var(--z)) calc(48px * var(--z)) calc(120px * var(--z)); }
.kb-page .icon-btn { font-size: calc(46px * var(--z)); line-height: 1; background: none; border: 0; padding: calc(4px * var(--z)); border-radius: var(--r); }
.kb-page .icon-btn:hover { background: var(--hover); }
.kb-page .ttl { width: 100%; border: 0; background: none; font-size: calc(36px * var(--z)); font-weight: 700; letter-spacing: -.025em; padding: calc(4px * var(--z)) 0; outline: none; color: var(--fg); }
.kb-page .meta { color: var(--fg-subtle); font-size: calc(12px * var(--z)); margin: calc(4px * var(--z)) 0 calc(24px * var(--z)); display: flex; gap: calc(12px * var(--z)); flex-wrap: wrap; align-items: center; }
.kb-editor { display: grid; grid-template-columns: 1fr 1fr; gap: calc(16px * var(--z)); }
.kb-editor textarea { min-height: 60vh; font-family: var(--mono); font-size: calc(13px * var(--z)); }
.kb-editor .preview { border-left: 1px solid var(--border-muted); padding-left: calc(16px * var(--z)); }
.md-toolbar { display: flex; gap: 2px; flex-wrap: wrap; padding: calc(4px * var(--z)); border: 1px solid var(--border); border-bottom: 0; border-radius: var(--r) var(--r) 0 0; background: var(--surface-2); }
.md-toolbar + textarea.input { border-radius: 0 0 var(--r) var(--r); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: calc(4px * var(--z)); }
.emoji-grid button { font-size: calc(22px * var(--z)); border: 0; background: none; padding: calc(6px * var(--z)); border-radius: var(--r); }
.emoji-grid button:hover { background: var(--hover); }
.kb-children { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(220px * var(--z)), 1fr)); gap: calc(8px * var(--z)); margin-top: calc(28px * var(--z)); }
.kb-children a { display: flex; gap: calc(8px * var(--z)); align-items: center; padding: calc(10px * var(--z)) calc(12px * var(--z)); border: 1px solid var(--border-muted); border-radius: var(--r); color: var(--fg); }
.kb-children a:hover { background: var(--hover); text-decoration: none; }
@media (max-width: 900px) { .kb { grid-template-columns: 1fr; } .kb-side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border-muted); } .kb-page { padding: calc(24px * var(--z)) calc(16px * var(--z)) calc(80px * var(--z)); } .kb-editor { grid-template-columns: 1fr; } .kb-editor .preview { border: 0; padding: 0; } }

/* ---------- права (матрица) ---------- */
.perm-table td, .perm-table th { padding: calc(8px * var(--z)) calc(12px * var(--z)); }
.perm-table .select { width: calc(170px * var(--z)); }
.lvl-0 { color: var(--fg-subtle); }
.lvl-1 { color: var(--accent); }
.lvl-2 { color: var(--success); }
.lvl-3 { color: var(--done); }

/* ---------- сравнение (прокат) ---------- */
.chips { display: flex; gap: calc(6px * var(--z)); flex-wrap: wrap; margin-bottom: calc(14px * var(--z)); }
.chip { display: inline-flex; gap: calc(6px * var(--z)); align-items: center; padding: 0 calc(12px * var(--z)); height: calc(30px * var(--z)); border-radius: 2em; border: 1px solid var(--border); background: var(--surface); color: var(--fg-muted); font-weight: 500; }
.chip:hover { color: var(--fg); border-color: var(--fg-subtle); }
.chip.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chip .n { font-size: calc(12px * var(--z)); opacity: .7; font-variant-numeric: tabular-nums; }
.cmp-bar { position: fixed; left: 50%; bottom: calc(20px * var(--z)); transform: translateX(-50%); z-index: 40; display: flex; gap: calc(10px * var(--z)); align-items: center; padding: calc(8px * var(--z)) calc(8px * var(--z)) calc(8px * var(--z)) calc(16px * var(--z)); border-radius: 2em; background: var(--fg); color: var(--bg); box-shadow: var(--shadow); animation: popIn .2s var(--ease); max-width: calc(100vw - calc(32px * var(--z))); }
.cmp-bar .btn { border-radius: 2em; }
tr.diff td, tr.diff th { background: var(--attention-muted); }

/* ---------- печать ---------- */
@media print {
  .app-header, .no-print, aside, .toasts { display: none !important; }
  body { background: #fff; color: #000; }
  main#view { padding: 0; max-width: none; }
  .layout-side { display: block; }
  .box, .table-wrap { border-color: #999; }
  .input, .select, textarea.input { border: 0; padding: 0; background: none; color: #000; height: auto; }
}

@media (max-width: 720px) {
  .app-header .bar { padding: 0 calc(12px * var(--z)); gap: calc(10px * var(--z)); }
  .brand .divider, .brand .product { display: none; }
  .gsearch kbd { display: none; }
  main#view { padding: calc(16px * var(--z)) calc(12px * var(--z)) calc(80px * var(--z)); }
  .hero { padding: calc(24px * var(--z)) calc(20px * var(--z)); }
  .hero h1 { font-size: calc(26px * var(--z)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- v0.2: звёзды, переключатели, сворачиваемые пункты ---------- */
.star-mark { display: inline-flex; vertical-align: -2px; margin-right: calc(6px * var(--z)); color: #e3b341; }
.star-mark svg { fill: currentColor; }
.star-mark.red { color: var(--danger); }
.star-btn { border: 0; background: none; padding: calc(4px * var(--z)); border-radius: calc(6px * var(--z)); color: var(--fg-subtle); display: inline-grid; place-items: center; }
.star-btn:hover { background: var(--hover); color: #e3b341; }
.star-btn.on { color: #e3b341; }
.star-btn.on svg { fill: currentColor; }

.switch { position: relative; display: inline-block; width: calc(38px * var(--z)); height: calc(22px * var(--z)); flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: calc(22px * var(--z)); background: var(--border); transition: background .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; left: calc(3px * var(--z)); top: calc(3px * var(--z)); width: calc(16px * var(--z)); height: calc(16px * var(--z)); border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--danger); }
.switch input:checked + span::before { transform: translateX(calc(16px * var(--z))); }

.sec-head { width: 100%; border: 0; border-bottom: 1px solid var(--border); text-align: left; cursor: pointer; color: var(--fg); font: inherit; }
.sec-head:hover { background: var(--hover); }
.sec-head .chev { display: inline-grid; color: var(--fg-muted); transition: transform .18s var(--ease); }
.sec.closed .sec-head { border-bottom-color: transparent; border-radius: var(--r); }
.sec.closed .sec-head .chev { transform: rotate(-90deg); }
.sec.closed .sec-body { display: none; }
.sec.muted-sec .sec-head h2 { color: var(--fg-muted); }
@media print { .sec.closed .sec-body { display: block; } .sec-head .chev { display: none; } }

.field-invalid { outline: 2px solid var(--danger); outline-offset: calc(4px * var(--z)); border-radius: calc(6px * var(--z)); }
.field-invalid > label { color: var(--danger); }
.input.invalid, .select.invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 calc(3px * var(--z)) var(--danger-muted); }

.type-chips { gap: calc(8px * var(--z)); }
.type-chip { position: relative; cursor: pointer; }
.type-chip input { position: absolute; opacity: 0; }
.type-chip span { display: inline-flex; align-items: center; gap: calc(6px * var(--z)); height: calc(34px * var(--z)); padding: 0 calc(16px * var(--z)); border-radius: 2em; border: 1px solid var(--border); background: var(--surface-2); font-weight: 600; transition: all .12s; }
.type-chip span::before { content: ""; width: calc(14px * var(--z)); height: calc(14px * var(--z)); border-radius: calc(4px * var(--z)); border: calc(1.5px * var(--z)) solid var(--fg-subtle); transition: all .12s; }
.type-chip input:checked + span { background: var(--accent-muted); border-color: var(--accent); color: var(--accent); }
.type-chip input:checked + span::before { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--surface); }
.type-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.type-chip input:disabled + span { opacity: .6; cursor: default; }

.urgent-btn { font-weight: 700; letter-spacing: .02em; }
.urgent-btn.on { background: var(--danger); border-color: var(--danger); color: #fff; }
.urgent-btn.on svg { fill: currentColor; }
.field.compact { min-width: calc(170px * var(--z)); }
.field.compact label { font-size: calc(12px * var(--z)); color: var(--fg-muted); font-weight: 500; }

.dt { display: flex; gap: calc(6px * var(--z)); }
.dt .input[type=date] { min-width: calc(140px * var(--z)); }
.dt .input[type=time] { width: calc(104px * var(--z)); min-width: 0; }
.fin tr.dep-head td { background: var(--surface-2); padding: calc(6px * var(--z)) calc(10px * var(--z)); border-top: 1px solid var(--border); }
.fin tr[data-line] td:first-child { padding-left: calc(14px * var(--z)); }

.pv-doc { display: grid; gap: calc(4px * var(--z)); }
.pv-title { font-size: calc(18px * var(--z)); font-weight: 650; letter-spacing: -.01em; }
.pv-h { margin: calc(18px * var(--z)) 0 calc(6px * var(--z)); font-size: calc(13px * var(--z)); text-transform: uppercase; letter-spacing: .05em; color: var(--fg-muted); }
table.pv { width: 100%; border-collapse: collapse; }
table.pv > tbody > tr > th, table.pv > tr > th { width: 34%; text-align: left; font-weight: 500; color: var(--fg-muted); padding: calc(6px * var(--z)) calc(12px * var(--z)) calc(6px * var(--z)) 0; vertical-align: top; border-top: 1px solid var(--border-muted); }
table.pv > tbody > tr > td, table.pv > tr > td { padding: calc(6px * var(--z)) 0; border-top: 1px solid var(--border-muted); }
table.pv tr.miss th { color: var(--danger); }
.miss-v { color: var(--danger); font-weight: 600; }
@media print {
  body.print-preview #app { display: none !important; }
  body.print-preview .modal-root { position: static; background: none; padding: 0; backdrop-filter: none; }
  body.print-preview .modal { box-shadow: none; width: 100%; }
  body.print-preview .modal-head, body.print-preview .modal-foot { display: none; }
}
.fin [data-f=req_type] { min-width: calc(150px * var(--z)); }
.fin [data-f=tax] { min-width: calc(150px * var(--z)); }
.fin .eff { font-size: calc(11px * var(--z)); color: var(--done); text-align: right; margin-top: 2px; min-height: 0; }
.fin .eff:empty { display: none; }
.dep-sum { font-size: calc(13px * var(--z)); color: var(--fg-muted); font-variant-numeric: tabular-nums; margin-left: calc(4px * var(--z)); }
.by-tax { display: flex; flex-wrap: wrap; gap: calc(6px * var(--z)); align-items: center; font-weight: 400; }
.by-tax .label { height: auto; padding: 2px calc(10px * var(--z)); }
.cp-box { padding: calc(12px * var(--z)) calc(14px * var(--z)); border: 1px dashed var(--border); border-radius: var(--r); }
.pay-table { max-width: calc(560px * var(--z)); }
.pay-table .input, .pay-table .select { min-width: calc(150px * var(--z)); }
.pay-std .t td { padding: calc(8px * var(--z)) calc(12px * var(--z)); }

/* ---------- v0.4: положение главного меню (сверху / слева / справа / снизу) ---------- */
.shell-body { min-width: 0; }
:root[data-nav="left"] .shell-body { padding-left: var(--side-w); }
:root[data-nav="right"] .shell-body { padding-right: var(--side-w); }
:root[data-nav="bottom"] .shell-body { padding-bottom: var(--bnav-h); }
:root[data-nav="left"] .app-nav, :root[data-nav="right"] .app-nav {
  position: fixed; top: var(--shell-top); bottom: 0; width: var(--side-w); z-index: 25;
  background: var(--header); padding: calc(10px * var(--z)) calc(8px * var(--z)); overflow-y: auto; overflow-x: hidden;
}
:root[data-nav="left"] .app-nav { left: 0; border-right: 1px solid var(--border-muted); }
:root[data-nav="right"] .app-nav { right: 0; border-left: 1px solid var(--border-muted); }
:root[data-nav="left"] .app-nav ul, :root[data-nav="right"] .app-nav ul { flex-direction: column; gap: 2px; }
:root[data-nav="left"] .app-nav a, :root[data-nav="right"] .app-nav a { height: calc(36px * var(--z)); padding: 0 calc(12px * var(--z)); }
:root[data-nav="left"] .app-nav a::before, :root[data-nav="right"] .app-nav a::before { inset: 1px 0; }
:root[data-nav="left"] .app-nav a.on::before, :root[data-nav="right"] .app-nav a.on::before { background: var(--hover); }
:root[data-nav="left"] .app-nav a.on::after { left: 0; right: auto; top: calc(8px * var(--z)); bottom: calc(8px * var(--z)); width: 3px; height: auto; }
:root[data-nav="right"] .app-nav a.on::after { right: 0; left: auto; top: calc(8px * var(--z)); bottom: calc(8px * var(--z)); width: 3px; height: auto; }
:root[data-nav="left"] .app-nav .lbl, :root[data-nav="right"] .app-nav .lbl { overflow: hidden; text-overflow: ellipsis; }
:root[data-nav="left"] .app-nav .counter, :root[data-nav="right"] .app-nav .counter { margin-left: auto; }
:root[data-nav="bottom"] .app-nav {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--bnav-h); z-index: 30; padding: 0 calc(8px * var(--z));
  background: var(--header); border-top: 1px solid var(--border-muted);
}
:root[data-nav="bottom"] .app-nav ul { height: 100%; justify-content: safe center; }
:root[data-nav="bottom"] .app-nav a { flex-direction: column; justify-content: center; gap: 2px; height: 100%; padding: 0 calc(10px * var(--z)); font-size: calc(11px * var(--z)); }
:root[data-nav="bottom"] .app-nav a > span.lbl { padding: 0; }
:root[data-nav="bottom"] .app-nav a::before { inset: calc(5px * var(--z)) 2px; }
:root[data-nav="bottom"] .app-nav a.on::after { top: -1px; bottom: auto; }
:root[data-nav="bottom"] .app-nav .counter { position: absolute; top: calc(4px * var(--z)); right: 2px; min-width: 16px; padding: 0 4px; font-size: 10px; line-height: 14px; }
:root[data-nav="bottom"] .update-banner, :root[data-nav="bottom"] .cmp-bar { bottom: calc(var(--bnav-h) + 16px); }
:root[data-nav="bottom"] .toasts { bottom: calc(var(--bnav-h) + 16px); }
@media print { .app-nav { display: none !important; } .shell-body { padding: 0 !important; } }

/* ---------- v0.4: настройки интерфейса ---------- */
.ui-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(170px * var(--z)), 1fr)); gap: calc(12px * var(--z)); }
.ui-opt { position: relative; cursor: pointer; }
.ui-opt input { position: absolute; opacity: 0; pointer-events: none; }
.ui-opt > span { display: grid; gap: calc(8px * var(--z)); padding: calc(10px * var(--z)); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.ui-opt:hover > span { border-color: var(--fg-subtle); }
.ui-opt input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ui-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-opt b { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.ui-prev { height: calc(78px * var(--z)); border-radius: var(--r); border: 1px solid var(--border-muted); display: grid; overflow: hidden; }
.ui-prev i { display: block; }
.scale-row { display: flex; flex-wrap: wrap; gap: 8px; }
.scale-row .ui-opt > span { padding: calc(8px * var(--z)) calc(14px * var(--z)); text-align: center; }
.tabs-line { display: flex; gap: 4px; border-bottom: 1px solid var(--border-muted); margin-bottom: calc(20px * var(--z)); }
.tabs-line a { padding: calc(8px * var(--z)) calc(12px * var(--z)); color: var(--fg-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: center; }
.tabs-line a.on { color: var(--fg); border-bottom-color: var(--tab-line-color, #fd8c73); font-weight: 600; }
.tabs-line a:hover { text-decoration: none; color: var(--fg); }

/* ---------- v0.4: закрытие направлений ---------- */
.icon.st-closed { color: var(--success); }
.icon.st-overdue { color: var(--danger); }
.t.closing td.dir { min-width: calc(150px * var(--z)); vertical-align: top; }
.t.closing .dir-st { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--fg-muted); }
.t.closing td.dir.closed .dir-st { color: var(--success); }
.t.closing td.dir.overdue .dir-st { color: var(--danger); }
.t.closing td.dir.overdue { background: var(--danger-muted); }
.t.closing td.dir .btn { margin-top: 6px; }

/* ---------- v0.4: чат — приветствие, объявления, помощник, статус направления ---------- */
.welcome { display: flex; gap: calc(12px * var(--z)); align-items: flex-start; padding: calc(12px * var(--z)) calc(14px * var(--z)); margin: calc(4px * var(--z)) 0 calc(14px * var(--z)); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.welcome > .icon { color: var(--accent); flex: none; margin-top: 2px; }
.welcome b { display: block; margin-bottom: 2px; }
.dir-pill { display: inline-flex; align-items: center; gap: 4px; font-size: calc(12px * var(--z)); padding: 1px calc(8px * var(--z)); border-radius: 2em; border: 1px solid var(--border); color: var(--fg-muted); white-space: nowrap; }
.dir-pill:hover { text-decoration: none; color: var(--fg); }
.dir-pill.closed { color: var(--success); border-color: var(--success); background: var(--success-muted); }
.dir-pill.overdue { color: var(--danger); border-color: var(--danger); background: var(--danger-muted); }
.msg.broadcast { background: var(--attention-muted); box-shadow: inset 2px 0 0 var(--attention); margin: 4px 0; }
.bc-card .bc-head { display: flex; align-items: center; gap: 6px; font-weight: 650; color: var(--attention); font-size: calc(13px * var(--z)); }
.bc-card .text { margin-top: 2px; font-size: calc(15px * var(--z)); }
.avatar.bot { background: var(--accent-muted); color: var(--accent); }
.msg.answer .answers { display: grid; gap: 6px; margin-top: 8px; max-width: calc(640px * var(--z)); }
.msg.answer .answers a { display: block; padding: calc(8px * var(--z)) calc(12px * var(--z)); border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); color: var(--fg); }
.msg.answer .answers a:hover { border-color: var(--accent); text-decoration: none; }
.msg.answer .answers .sec { display: inline-block; font-size: calc(11px * var(--z)); color: var(--fg-subtle); margin-right: 8px; text-transform: uppercase; letter-spacing: .04em; }
.chat-side .icon.st-closed, .chat-side .icon.st-overdue { opacity: 1; }

/* ---------- v0.4: папка проекта ---------- */
.pfiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pf-dir { padding: calc(12px * var(--z)) calc(14px * var(--z)); border-left: 1px solid var(--border-muted); min-width: 0; }
.pf-dir:first-child { border-left: 0; }
.pf-dir-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.pf-dir-head .btn { margin-left: auto; }
.pf-ver { margin-bottom: 8px; }
.pf-ver-head { display: flex; align-items: center; gap: 4px; font-size: calc(12px * var(--z)); font-weight: 600; color: var(--fg-muted); margin-bottom: 2px; }
.pf-file { display: flex; align-items: center; gap: 6px; padding: 2px 0 2px calc(14px * var(--z)); font-size: calc(13px * var(--z)); min-width: 0; }
.pf-file a { min-width: 0; flex: 1; }
@media (max-width: 900px) { .pfiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- v0.4: заявка на доход ---------- */
.sec-st { display: inline-flex; align-items: center; margin-left: 8px; }
.sec-st.ok { color: var(--success); }
.sec-st.bad { color: var(--danger); }
.delta { font-size: calc(11px * var(--z)); font-weight: 650; white-space: nowrap; }
.delta.plus { color: var(--success); }
.delta.minus { color: var(--danger); }
.cp-note { display: inline-block; margin-left: 4px; font-size: calc(11px * var(--z)); color: var(--done); border: 1px solid var(--done); border-radius: 2em; padding: 0 6px; line-height: 1.5; vertical-align: 1px; }
.cp-note[hidden] { display: none; }
.tot-k { font-size: calc(11px * var(--z)); color: var(--fg-muted); font-weight: 500; text-transform: none; }
.pay-table.pay-bad tfoot td { background: var(--danger-muted); }
.att-list { display: grid; gap: 2px; margin-bottom: 6px; }
.att-list .pf-file { padding-left: 0; }
.cp-table { margin-top: 2px; }
.sec-head h2 .sec-st { vertical-align: -2px; }

/* ---------- v0.5: направления в доходе, история, сроки закрытия ---------- */
.fin .dep-sel { width: auto; min-width: calc(250px * var(--z)); font-weight: 600; }
.fin tr.add-dep td { background: var(--bg-inset); }
.log .it { align-items: flex-start; }
.log .log-diff { flex: none; gap: 4px; }
.log .log-more { width: 100%; justify-content: center; margin-bottom: 6px; }
.diff-t td { vertical-align: top; white-space: pre-wrap; }
.diff-t td.was { color: var(--danger); background: var(--danger-muted); }
.diff-t td.now { color: var(--success); background: var(--success-muted); }
.dl-box { display: inline-grid; gap: 1px; padding: calc(6px * var(--z)) calc(10px * var(--z)); border-radius: var(--r); border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 6px; }
.dl-box b { font-size: calc(15px * var(--z)); font-weight: 700; }
.dl-box .small { color: var(--fg-muted); }
.dl-box.hot { border-color: var(--danger); background: var(--danger-muted); color: var(--danger); }
.dl-box.hot .small { color: var(--danger); }
.dl-box.none { color: var(--fg-muted); }
.t.closing td.dir.overdue { background: transparent; }
.ans-group { margin-top: 10px; max-width: calc(680px * var(--z)); }
.ans-title { font-weight: 650; display: flex; align-items: center; gap: 6px; }
.ans-empty { display: flex; align-items: center; gap: 6px; color: var(--success); font-size: calc(13px * var(--z)); margin-top: 4px; }
.msg.answer .answers a.bad { box-shadow: inset 3px 0 0 var(--danger); }
.msg.answer .answers a.warn { box-shadow: inset 3px 0 0 var(--attention); }

/* ---------- v0.6: закрытие — фильтры, крупные кнопки, запросы на открытие ---------- */
.cl-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.cl-filters .select { width: auto; }
.t.closing th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.t.closing th.sortable:hover { color: var(--fg); }
.t.closing th.sortable.on { color: var(--fg); }
.t.closing td.dir { min-width: calc(210px * var(--z)); width: 17%; }
.t.closing td.dir.dim { opacity: .45; }
.dir-cell { display: grid; gap: 6px; width: 100%; min-width: calc(190px * var(--z)); }
.dir-cell .dl-box { display: grid; width: 100%; margin: 0; min-height: calc(54px * var(--z)); align-content: center; }
.dl-box.closed { border-color: var(--success); background: var(--success-muted); color: var(--success); }
.dl-box.closed b { display: flex; align-items: center; gap: 6px; }
.dl-box.closed .small { color: var(--fg-muted); }
.dir-cell .btn.big { width: 100%; min-height: calc(54px * var(--z)); height: auto; justify-content: center; font-size: calc(15px * var(--z)); font-weight: 650; border-radius: var(--r); }
.dir-cell .btn.big.close-btn { border-color: var(--success); color: var(--success); }
.dir-cell .btn.big.close-btn:hover { background: var(--success-muted); }
.dir-cell .btn.big.close-btn.hot { border-color: var(--danger); color: #fff; background: var(--danger); }
.rq-box { padding: calc(6px * var(--z)) calc(10px * var(--z)); border: 1px solid var(--attention); background: var(--attention-muted); border-radius: var(--r); }
.rq-box b { display: flex; align-items: center; gap: 4px; color: var(--attention); font-size: calc(13px * var(--z)); }
.rq-reason { margin-top: 2px; white-space: pre-wrap; }
.closed-notice { align-items: center; }

/* ---------- v0.7: список заявок ---------- */
.list-filters { flex-wrap: wrap; gap: 8px; align-items: center; }
.list-filters .select { width: auto; max-width: calc(220px * var(--z)); }
.t th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.t th.sortable:hover, .t th.sortable.on { color: var(--fg); }
.t.req-list tfoot td { font-weight: 650; }

/* ---------- v0.7: настраиваемая раскладка окон ---------- */
.lay { display: grid; grid-template-columns: minmax(0, 1fr) calc(24px * var(--z)) var(--lay-side-w, calc(300px * var(--z))); align-items: start; }
.lay.side-empty { grid-template-columns: minmax(0, 1fr) 0 0; }
.lay.side-empty > .lay-split { display: none; }
.lay > .lay-toolbar { grid-column: 1 / -1; }
.lay-zone { display: grid; gap: calc(16px * var(--z)); align-content: start; min-width: 0; }
.lay-zone[data-zone="main"] { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.lay-zone[data-zone="main"] > [data-win] { grid-column: span 12; }
.lay-zone[data-zone="main"] > [data-win][data-span="3"] { grid-column: span 3; }
.lay-zone[data-zone="main"] > [data-win][data-span="4"] { grid-column: span 4; }
.lay-zone[data-zone="main"] > [data-win][data-span="5"] { grid-column: span 5; }
.lay-zone[data-zone="main"] > [data-win][data-span="6"] { grid-column: span 6; }
.lay-zone[data-zone="main"] > [data-win][data-span="7"] { grid-column: span 7; }
.lay-zone[data-zone="main"] > [data-win][data-span="8"] { grid-column: span 8; }
.lay-zone[data-zone="main"] > [data-win][data-span="9"] { grid-column: span 9; }
.lay-zone[data-zone="main"] > [data-win][data-span="10"] { grid-column: span 10; }
.lay-zone[data-zone="main"] > [data-win][data-span="11"] { grid-column: span 11; }
.lay-zone > [data-win] { position: relative; min-width: 0; margin: 0; }
.lay-zone > [data-win].win-fixed-h { overflow: auto; }
.win-hidden { display: none !important; }
.lay-toolbar { display: flex; align-items: center; gap: 10px; padding: calc(10px * var(--z)) calc(14px * var(--z)); margin-bottom: calc(14px * var(--z));
  border: 1px solid var(--accent); background: var(--accent-muted); border-radius: var(--r-lg); font-size: calc(13px * var(--z)); }
.lay-toolbar > .icon { color: var(--accent); flex: none; }
.lay-toolbar.lay-hint { border-color: var(--border); background: var(--surface-2); color: var(--fg-muted); padding: calc(4px * var(--z)) calc(10px * var(--z)); }
.lay-edit > .lay-zone { min-height: calc(120px * var(--z)); padding: 6px; border: 1px dashed var(--border); border-radius: var(--r-lg); }
.lay-edit > .lay-zone > [data-win] { outline: 1px dashed var(--accent); outline-offset: 2px; }
.lay-edit > .lay-zone > .win-dragging { opacity: .5; outline-style: solid; }
.lay > .lay-split { align-self: stretch; min-height: 100%; }
.lay-edit > .lay-split { cursor: col-resize; position: relative; }
.lay-edit > .lay-split::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--accent); opacity: .5; }
.lay-edit > .lay-split:hover::after { opacity: 1; }
.win-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 6px; padding: 4px 6px; background: var(--accent); color: #fff;
  border-radius: var(--r) var(--r) 0 0; font-size: calc(12px * var(--z)); font-weight: 600; }
.win-bar .win-drag { cursor: grab; display: inline-flex; letter-spacing: -6px; padding-right: 6px; }
.win-bar .win-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-bar .win-ctl { border: 1px solid rgba(255,255,255,.5); background: rgba(255,255,255,.12); color: #fff; border-radius: 4px; height: calc(22px * var(--z)); min-width: calc(26px * var(--z));
  padding: 0 6px; font-size: calc(12px * var(--z)); font-weight: 700; display: inline-grid; place-items: center; cursor: pointer; }
.win-bar .win-ctl:hover { background: rgba(255,255,255,.28); }
.win-bar .win-main { margin-left: 6px; padding: 0 6px; border-radius: 99px; background: rgba(255,255,255,.2); font-size: calc(10.5px * var(--z)); font-weight: 600; vertical-align: 1px; }
.win-bar .win-w { font-size: calc(12px * var(--z)); opacity: .85; }
.win-resize-x { position: absolute; top: 30px; right: 0; bottom: 18px; width: 10px; cursor: ew-resize; z-index: 4; }
.win-resize-x::after { content: ""; position: absolute; top: 50%; left: 3px; width: 4px; height: 42px; margin-top: -21px; border-radius: 2px; background: var(--accent); opacity: .6; }
.win-resize-x:hover::after { opacity: 1; }
.lay:not(.lay-edit) .pj-win-pay:has(#pj-pay:empty) { display: none; }
.lay-removed { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; color: var(--fg-muted); }
.lay-removed .chip { margin: 0; }
.win-resize { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: ns-resize; z-index: 4;
  background: linear-gradient(135deg, transparent 50%, var(--accent) 50%); border-bottom-right-radius: var(--r-lg); }
@media (max-width: 1000px) { .lay { grid-template-columns: 1fr !important; } .lay > .lay-split { display: none; } .lay-zone[data-zone="main"] > [data-win][data-span] { grid-column: span 12; } }
@media print { .lay { display: block; } .lay-zone { display: block; } .lay-zone > [data-win] { margin-bottom: 12px; height: auto !important; overflow: visible !important; } }
.dir-block { color: var(--attention); line-height: 1.35; }
.dir-cell .btn.big.close-btn.blocked { border-color: var(--border); color: var(--fg-muted); }

/* ---------- v0.8: аватары и карточка сотрудника ---------- */
.avatar.photo { background-color: var(--surface-2); background-size: cover; background-position: center; color: transparent; }
.avatar.xl { width: calc(96px * var(--z)); height: calc(96px * var(--z)); font-size: calc(30px * var(--z)); }
.multi { display: grid; gap: 6px; }
.multi .row { flex-wrap: nowrap; }
.multi .row .input { flex: 1; }
.roles-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(200px * var(--z)), 1fr)); gap: 6px 12px; }
.av-edit { display: flex; align-items: center; gap: 14px; }
.crop { position: relative; width: 280px; height: 280px; margin: 0 auto; border-radius: var(--r-lg); overflow: hidden; background: #000; touch-action: none; cursor: grab; user-select: none; }
.crop canvas { display: block; }
.crop::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0,0,0,.55); pointer-events: none; outline: 2px solid rgba(255,255,255,.7); outline-offset: -2px; }
.crop-ctl { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.crop-ctl input[type=range] { flex: 1; }

/* ---------- списки заявок: фильтры в заголовках столбцов (как в Excel) ---------- */
.t .th-in { display: inline-flex; align-items: center; gap: calc(4px * var(--z)); }
.t .th-f { display: inline-grid; place-items: center; width: calc(20px * var(--z)); height: calc(20px * var(--z)); padding: 0; border: 1px solid transparent; border-radius: 4px;
  background: transparent; color: var(--fg-subtle); cursor: pointer; flex: none; }
.t .th-f:hover { background: var(--hover); color: var(--fg); border-color: var(--border); }
.t .th-f.on { color: var(--accent); background: var(--accent-muted); border-color: var(--accent); }
.t th.filtered { color: var(--accent); }
.cf-pop { position: absolute; z-index: 70; width: calc(290px * var(--z)); display: grid; gap: calc(6px * var(--z)); padding: calc(8px * var(--z));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); animation: popIn .14s var(--ease); }
.cf-pop .cf-title { display: flex; align-items: center; gap: 6px; font-weight: 600; padding: 2px 4px; color: var(--fg-muted); font-size: calc(12px * var(--z)); }
.cf-pop .cf-sort { display: flex; align-items: center; gap: 8px; width: 100%; padding: calc(6px * var(--z)) calc(8px * var(--z)); border: 0; border-radius: var(--r); background: none; color: var(--fg); text-align: left; cursor: pointer; }
.cf-pop .cf-sort:hover { background: var(--hover); }
.cf-pop .cf-sort.on { color: var(--accent); font-weight: 600; }
.cf-pop hr { border: 0; border-top: 1px solid var(--border-muted); margin: 2px 0; }
.cf-pop .cf-list { display: grid; gap: 1px; max-height: calc(260px * var(--z)); overflow: auto; padding: 4px 6px; border: 1px solid var(--border-muted); border-radius: var(--r); }
.cf-pop .cf-list .check { display: flex; padding: calc(3px * var(--z)) 2px; }
.cf-pop .cf-list .check .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-pop .cf-list [hidden] { display: none !important; }
.cf-pop .cf-all { border-bottom: 1px solid var(--border-muted); margin-bottom: 2px; padding-bottom: 5px !important; }
.cf-pop .cf-range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cf-pop .cf-range label { display: grid; gap: 2px; }
.cf-pop .cf-foot { display: flex; align-items: center; gap: 6px; padding-top: 2px; }
.list-box .list-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 0 calc(12px * var(--z)); border-bottom: 1px solid var(--border-muted); }
.list-box .list-bar .tabs { border: 0; margin: 0; flex: 0 1 auto; }
.list-box .list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-left: auto; padding: calc(8px * var(--z)) 0; }
.list-box .list-q { width: calc(260px * var(--z)); }
.list-box .cf-chips { display: flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; justify-content: flex-end; }
.cf-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 8px; border: 1px solid var(--accent); background: var(--accent-muted); color: var(--fg); border-radius: 999px; font-size: calc(12px * var(--z)); max-width: 100%; }
.cf-chip > .icon { color: var(--accent); }
.cf-chip button { display: inline-grid; place-items: center; width: 18px; height: 18px; border: 0; border-radius: 50%; background: none; color: var(--fg-muted); cursor: pointer; padding: 0; }
.cf-chip button:hover { background: var(--hover); color: var(--fg); }
.list-box #list .table-wrap { border: 0; border-radius: 0 0 var(--r) var(--r); }
.list-box #list .blank { padding: calc(28px * var(--z)) 0; }
.list-box [data-xt-table] .table-wrap { border: 0; border-radius: 0 0 var(--r) var(--r); }
.list-box [data-xt-table] .blank { padding: calc(28px * var(--z)) 0; }
.list-box .list-tools .xt-before { color: var(--fg-muted); font-size: calc(12.5px * var(--z)); }
.t.xt tfoot td { font-weight: 650; }
.t .th-sub { display: block; font-weight: 400; color: var(--fg-subtle); font-size: calc(10.5px * var(--z)); text-transform: none; letter-spacing: 0; white-space: nowrap; }
.t .dir-tags .label { margin: 1px 3px 1px 0; }
.ls-stats { grid-template-columns: repeat(auto-fit, minmax(calc(130px * var(--z)), 1fr)); }
.ls-stats .stat { padding: 2px 0; }
.ls-stats .stat .v { font-size: calc(20px * var(--z)); }
.dir-bars { display: grid; gap: 2px; }
.dir-bar { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) calc(34px * var(--z)); align-items: center; gap: 10px; padding: calc(4px * var(--z)) 6px;
  border: 0; border-radius: var(--r); background: none; color: var(--fg); text-align: left; cursor: pointer; font: inherit; }
.dir-bar:hover { background: var(--hover); }
.dir-bar.on { background: var(--accent-muted); }
.dir-bar .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dir-bar .bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.dir-bar .bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.dir-bar b { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- виды страниц ---------- */
.lay-btns .btn .vw-name { max-width: calc(170px * var(--z)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-muted); font-weight: 500; }
.lay-btns .btn .vw-name i { font-style: normal; color: var(--attention, #d29922); margin-left: 2px; font-weight: 700; }
.lay-btns [data-lay-views] { gap: 4px; }
.vw-menu { max-height: min(80vh, calc(640px * var(--z))); overflow: auto; }
.vw-menu .vw-sec { padding: calc(6px * var(--z)) calc(10px * var(--z)) 2px; font-size: calc(11px * var(--z)); text-transform: uppercase; letter-spacing: .04em; color: var(--fg-subtle); font-weight: 600; }
.vw-menu .vw-row { display: flex; align-items: center; border-radius: var(--r); }
.vw-menu .vw-row:hover { background: var(--hover); }
.vw-menu .vw-row.on .vw-n { font-weight: 600; color: var(--accent); }
.vw-menu .vw-row > .vw-item { flex: 1; min-width: 0; align-items: flex-start; }
.vw-menu .vw-row > .vw-item:hover { background: none; }
.vw-menu .vw-item .grow { display: grid; gap: 1px; min-width: 0; }
.vw-menu .vw-item .grow > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-menu .vw-item > .icon, .vw-menu .vw-sp { flex: none; width: calc(14px * var(--z)); margin-top: 2px; color: var(--accent); }
.vw-menu .vw-row > .vw-ic { width: auto; flex: none; padding: calc(5px * var(--z)); color: var(--fg-subtle); }
.vw-menu .vw-row > .vw-ic:hover { color: var(--fg); background: var(--surface-2); }
.vw-menu .vw-empty, .vw-menu .vw-tip { padding: calc(4px * var(--z)) calc(10px * var(--z)) calc(6px * var(--z)); }
.vw-menu .vw-tip { display: block; line-height: 1.45; }
.vw-menu .vw-tip .icon { vertical-align: -1px; margin-right: 4px; }
.vw-card { display: grid; gap: calc(4px * var(--z)); padding: calc(10px * var(--z)) calc(12px * var(--z)); border: 1px solid var(--accent); border-radius: var(--r-lg); background: var(--accent-muted); max-width: calc(520px * var(--z)); }
.vw-card .vw-head { display: flex; align-items: center; gap: 6px; }
.vw-card .vw-head .icon { color: var(--accent); flex: none; }
.dir-bars { grid-template-columns: repeat(auto-fill, minmax(calc(300px * var(--z)), 1fr)); column-gap: calc(24px * var(--z)); }

/* ---------- стикеры и эмодзи (Фрезик) ---------- */
.fz-emoji { width: 1.45em; height: 1.45em; vertical-align: -0.38em; margin: 0 1px; object-fit: contain; }
.fz-emoji.big { width: calc(40px * var(--z)); height: calc(40px * var(--z)); vertical-align: middle; margin: 0; }
.msg .text.jumbo .fz-emoji { width: calc(56px * var(--z)); height: calc(56px * var(--z)); vertical-align: middle; }
.msg .sticker { padding: calc(2px * var(--z)) 0; }
.msg .sticker img { display: block; width: calc(160px * var(--z)); height: calc(160px * var(--z)); }
.composer .fz-btn { padding: calc(4px * var(--z)); }
.composer .fz-btn { color: var(--fg-muted); }
.composer .fz-btn:hover, .composer .fz-btn.on { color: var(--accent); }
.fz-pick { position: absolute; right: calc(20px * var(--z)); bottom: calc(100% - 8px); width: min(calc(420px * var(--z)), calc(100% - 40px)); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); z-index: 20; display: flex; flex-direction: column; overflow: hidden; }
.fz-pick-tabs { display: flex; gap: 2px; padding: calc(6px * var(--z)); border-bottom: 1px solid var(--border); }
.fz-pick-tabs button { flex: 1; border: 0; background: none; color: var(--fg-muted); font: inherit; font-weight: 600; padding: calc(6px * var(--z)); border-radius: var(--r); cursor: pointer; }
.fz-pick-tabs button:hover { background: var(--hover); color: var(--fg); }
.fz-pick-tabs button.on { background: var(--hover); color: var(--fg); box-shadow: inset 0 -2px 0 var(--accent); }
.fz-pick-grid { display: grid; gap: calc(4px * var(--z)); padding: calc(8px * var(--z)); max-height: calc(300px * var(--z)); overflow: auto; }
.fz-pick-grid.st { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fz-pick-grid.em { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.fz-pick-grid button { border: 0; background: none; padding: calc(4px * var(--z)); border-radius: var(--r); cursor: pointer; display: grid; place-items: center; }
.fz-pick-grid button:hover, .fz-pick-grid button:focus-visible { background: var(--hover); outline: none; }
.fz-pick-grid button:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.fz-pick-grid.st img { width: 100%; max-width: calc(88px * var(--z)); height: auto; aspect-ratio: 1; }
.fz-pick-foot { padding: calc(6px * var(--z)) calc(12px * var(--z)) calc(8px * var(--z)); color: var(--fg-subtle); font-size: calc(12px * var(--z)); border-top: 1px solid var(--border-muted, var(--border)); }
/* стандартные смайлики */
.fz-jump { display: flex; gap: 2px; padding: calc(4px * var(--z)) calc(6px * var(--z)); border-bottom: 1px solid var(--border-muted, var(--border)); overflow-x: auto; }
.fz-jump button { border: 0; background: none; cursor: pointer; font-size: calc(18px * var(--z)); line-height: 1; padding: calc(5px * var(--z)); border-radius: var(--r); font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.fz-jump button:hover { background: var(--hover); }
.fz-scroll { max-height: calc(300px * var(--z)); overflow: auto; padding-bottom: calc(6px * var(--z)); }
.fz-scroll .fz-pick-grid { max-height: none; overflow: visible; padding-top: 0; }
.fz-sec { padding: calc(8px * var(--z)) calc(12px * var(--z)) calc(4px * var(--z)); font-size: calc(11px * var(--z)); text-transform: uppercase; letter-spacing: .06em; color: var(--fg-subtle); font-weight: 600; }
.fz-pick-grid.uni-grid { grid-template-columns: repeat(auto-fill, minmax(calc(38px * var(--z)), 1fr)); gap: 0; }
.fz-pick-grid.uni-grid .fz-emoji.big { width: calc(28px * var(--z)); height: calc(28px * var(--z)); }
.fz-pick-grid button.uni { font-size: calc(24px * var(--z)); line-height: 1; padding: calc(5px * var(--z)) 0; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.msg .text.jumbo { font-size: calc(40px * var(--z)); line-height: 1.2; }
.msg .text.jumbo .fz-emoji { width: calc(56px * var(--z)); height: calc(56px * var(--z)); }

/* ---------- заявка на доход: сворачиваемая история, под-чат «Доход» ---------- */
.hist > .sec-head { display: flex; align-items: center; gap: 8px; }
.hist > .sec-head h3 { flex: 1; }
.hist.closed > .sec-head { border-bottom-color: transparent; border-radius: var(--r); }
.hist.closed > .sec-head .chev { transform: rotate(-90deg); }
.hist.closed > .hist-body { display: none; }

/* ---------- готовые аватары ---------- */
.av-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(96px * var(--z)), 1fr)); gap: calc(12px * var(--z)); }
.av-preset { display: grid; justify-items: center; gap: 6px; padding: 8px 4px; border: 1px solid transparent; border-radius: var(--r-lg); background: none; color: var(--fg-muted); cursor: pointer; font: inherit; font-size: calc(12px * var(--z)); }
.av-preset img { width: calc(72px * var(--z)); height: calc(72px * var(--z)); border-radius: 50%; transition: transform .15s var(--ease); box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.av-preset:hover { border-color: var(--border); background: var(--hover); color: var(--fg); }
.av-preset:hover img { transform: scale(1.06); }
.av-preset.busy { opacity: .5; pointer-events: none; }

/* ---------- профиль: мои виды ---------- */
.vw-list { display: grid; }
.vw-line { display: flex; align-items: center; gap: 8px; padding: calc(8px * var(--z)) calc(16px * var(--z)); border-top: 1px solid var(--border-muted); }
.vw-line:first-child { border-top: 0; }
.vw-line.on { background: var(--accent-muted); }
.vw-line .vw-mark { width: 16px; color: var(--accent); display: inline-grid; }
.vw-line .grow { min-width: 0; }
/* окно под-чата в заявке */
.mchat .box-head { display: flex; align-items: center; gap: 8px; }
.mchat .box-head h3 { flex: 1; display: flex; align-items: center; gap: 6px; }
.mchat .mc-feed { max-height: calc(320px * var(--z)); min-height: calc(90px * var(--z)); overflow: auto; padding: calc(8px * var(--z)) calc(10px * var(--z)); display: grid; gap: 2px; align-content: start; }
.mchat.win-fixed-h { display: flex; flex-direction: column; }
.mchat.win-fixed-h .mc-feed { max-height: none; flex: 1; }
.mchat .mc-empty { padding: 10px 4px; }
.mchat .mc-day { text-align: center; color: var(--fg-subtle); font-size: calc(11px * var(--z)); margin: 6px 0 2px; }
.mchat .mc-sys { color: var(--fg-muted); font-size: calc(12px * var(--z)); padding: 3px 2px; }
.mchat .mc-msg { display: grid; grid-template-columns: calc(24px * var(--z)) minmax(0, 1fr); gap: 8px; padding: 4px 2px; }
.mchat .mc-msg.cont { padding-top: 0; }
.mchat .mc-msg .who { display: flex; gap: 6px; align-items: baseline; font-size: calc(12px * var(--z)); }
.mchat .mc-msg .who time { color: var(--fg-subtle); font-size: calc(11px * var(--z)); }
.mchat .mc-msg .text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: calc(13px * var(--z)); }
.mchat .mc-msg .text .fz-emoji { width: calc(20px * var(--z)); height: calc(20px * var(--z)); vertical-align: -4px; }
.mchat .mc-msg .text.jumbo .fz-emoji { width: calc(40px * var(--z)); height: calc(40px * var(--z)); }
.mchat .mc-sticker img { width: calc(80px * var(--z)); height: calc(80px * var(--z)); display: block; }
.mchat .mc-comp { display: flex; gap: 6px; align-items: flex-end; padding: calc(8px * var(--z)) calc(10px * var(--z)); border-top: 1px solid var(--border-muted); }
.mchat .mc-comp textarea { resize: none; min-height: calc(32px * var(--z)); }
.mchat .mention { color: var(--accent); font-weight: 600; }
.mchat .mention.me { background: var(--attention-muted); border-radius: 3px; padding: 0 2px; }
.av-group { font-weight: 600; margin: calc(14px * var(--z)) 0 calc(6px * var(--z)); }
.av-group:first-of-type { margin-top: 0; }
.tabs.wrap { flex-wrap: wrap; overflow: visible; }
.t.kvt { width: 100%; }
.t.kvt td:first-child { width: calc(200px * var(--z)); white-space: nowrap; }

/* ---------- Площадки ---------- */
.doc-row { display: flex; align-items: center; gap: 8px; padding: calc(5px * var(--z)) 6px; border-radius: var(--r-sm, 6px); color: var(--fg); text-decoration: none; min-width: 0; }
.doc-row:hover { background: var(--hover); }
.doc-row .grow { min-width: 0; }
.doc-row > svg { flex: none; color: var(--fg-muted); }
.vpick { display: grid; gap: 2px; max-height: min(56vh, calc(460px * var(--z))); overflow: auto; margin: 0 -6px; }
.vpick-it { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: none; color: var(--fg); font: inherit; padding: calc(7px * var(--z)) 8px; border-radius: var(--r-sm, 6px); cursor: pointer; }
.vpick-it:hover, .vpick-it:focus-visible { background: var(--hover); outline: none; }
.vpick-it .grow { display: grid; gap: 2px; min-width: 0; }
.vpick-it .grow > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.venue-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 4px 3px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); font-size: calc(13px * var(--z)); }
.venue-chip a { color: var(--fg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.venue-chip button { border: 0; background: none; color: var(--fg-muted); cursor: pointer; display: inline-grid; padding: 2px; border-radius: 50%; }
.venue-chip button:hover { color: var(--fg); background: var(--hover); }
.venue-row { display: flex; gap: 8px; align-items: flex-start; }
.venue-row > .input, .venue-row > textarea { flex: 1; min-width: 0; }

/* ---------- ЗУП ---------- */
.select.sm { height: calc(28px * var(--z)); padding: 0 calc(24px * var(--z)) 0 calc(8px * var(--z)); font-size: calc(13px * var(--z)); background-position: right 6px center; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; display: inline-flex; align-items: center; gap: 3px; margin-top: 3px; }
.link-btn:hover { text-decoration: underline; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--fg-muted); padding: calc(5px * var(--z)) calc(12px * var(--z)); font: inherit; font-size: calc(13px * var(--z)); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--accent-muted); color: var(--fg); font-weight: 600; }
.day-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.day-strip .day { flex: none; min-width: calc(108px * var(--z)); display: grid; gap: 2px; text-align: left; padding: calc(6px * var(--z)) calc(10px * var(--z)); border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); color: var(--fg); font: inherit; font-size: calc(13px * var(--z)); cursor: pointer; }
.day-strip .day:hover { border-color: var(--fg-subtle); }
.day-strip .day.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-muted); }
.day-strip .day.empty { color: var(--fg-muted); }
.day-strip .day .wt { font-size: calc(12px * var(--z)); color: var(--fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: calc(150px * var(--z)); }
.day-strip .day.on .wt { color: var(--accent); }
.day-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: calc(10px * var(--z)) calc(16px * var(--z)); border-top: 1px solid var(--border); }
.day-head #day-sum { gap: 14px; }
.shifts-wrap { border-left: 0; border-right: 0; border-radius: 0; }
.t.shifts-t td { padding: calc(4px * var(--z)) calc(6px * var(--z)); vertical-align: top; }
.t.shifts-t td.num { padding-top: calc(9px * var(--z)); }
.t.shifts-t tr.ro { background: var(--surface-2, transparent); }
.t.shifts-t tr.ro input, .t.shifts-t tr.ro select { opacity: .75; }
.t.shifts-t { min-width: calc(1180px * var(--z)); }
.t.shifts-t .input[type=time] { width: calc(112px * var(--z)); }
.t.shifts-t [data-f=dept] { min-width: calc(118px * var(--z)); }
.t.shifts-t .xd { width: calc(76px * var(--z)); margin-top: 3px; }
.ot { color: var(--attention); font-weight: 600; }
.neg { color: var(--danger); }
.steps { display: grid; gap: 8px; }
.steps .step { display: flex; gap: 10px; align-items: flex-start; color: var(--fg-muted); font-size: calc(13px * var(--z)); }
.steps .step .dot { flex: none; width: calc(20px * var(--z)); height: calc(20px * var(--z)); border-radius: 50%; display: grid; place-items: center; font-size: calc(11px * var(--z)); border: 1px solid var(--border); background: var(--surface); }
.steps .step.done { color: var(--fg); }
.steps .step.done .dot { background: var(--success); border-color: var(--success); color: #fff; }
.steps .step.cur { color: var(--fg); }
.steps .step.cur .dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px var(--accent-muted); }
.steps .step.bad .dot { border-color: var(--danger); color: var(--danger); background: var(--danger-muted); }
.issues { display: grid; gap: 4px; max-height: calc(360px * var(--z)); overflow: auto; }
.issue { display: flex; gap: 8px; align-items: flex-start; text-align: left; border: 0; background: none; padding: calc(4px * var(--z)) 4px; border-radius: 4px; font: inherit; font-size: calc(13px * var(--z)); color: var(--fg); cursor: pointer; }
.issue:hover { background: var(--hover); }
.issue > svg { flex: none; margin-top: 2px; }
.issue.error > svg { color: var(--danger); }
.issue.warn > svg { color: var(--attention); }
.issue.info > svg { color: var(--accent); }
.pick-list { display: grid; gap: 1px; max-height: min(44vh, calc(360px * var(--z))); overflow: auto; border: 1px solid var(--border); border-radius: var(--r); padding: 4px; }
.pick-list .pick { padding: calc(5px * var(--z)) 8px; border-radius: 4px; }
.pick-list .pick:hover { background: var(--hover); }
.pick-list .pick.on { background: var(--accent-muted); }
.grid-wrap { max-height: 70vh; }
.t.grid-t th, .t.grid-t td { padding: calc(var(--grid-y, 4px) * var(--z)) calc(6px * var(--z)); font-size: calc(12px * var(--z)); }
.t.grid-t .sticky { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: calc(200px * var(--z)); }
.t.grid-t .gc { text-align: center; min-width: calc(72px * var(--z)); cursor: pointer; white-space: nowrap; }
.t.grid-t td.gc.on { background: var(--accent-muted); }
.t.grid-t .gc:hover { outline: 1px solid var(--accent); }
.t.rates-t td { vertical-align: top; }
@media print { .day-strip, .shifts-t .xd { display: none; } }

/* ---------- Игры в чате ---------- */
.game-bot { display: grid; place-items: center; width: calc(36px * var(--z)); height: calc(36px * var(--z)); border-radius: 50%; background: var(--accent-muted); font-size: calc(18px * var(--z)); }
.champ { margin-left: 4px; font-size: calc(13px * var(--z)); cursor: default; }
.game-card { margin-top: calc(4px * var(--z)); border: 1px solid var(--border); border-radius: var(--r-lg); padding: calc(10px * var(--z)) calc(14px * var(--z)); max-width: calc(560px * var(--z)); background: var(--surface); display: grid; gap: calc(8px * var(--z)); justify-items: start; }
.game-card.open, .game-card.play, .game-card.pending { border-color: var(--accent); box-shadow: inset calc(3px * var(--z)) 0 0 var(--accent); }
.game-card.closed, .game-card.done { box-shadow: inset calc(3px * var(--z)) 0 0 var(--success); }
.game-card .ok { color: var(--success); font-weight: 600; }
.game-card .bad { color: var(--danger); font-weight: 600; }
.qq { font-weight: 600; font-size: calc(15px * var(--z)); }
.qopts { display: grid; gap: 6px; width: 100%; }
.qopt { display: flex; gap: 10px; align-items: baseline; text-align: left; width: 100%; padding: calc(7px * var(--z)) calc(10px * var(--z)); border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); color: var(--fg); font: inherit; }
button.qopt { cursor: pointer; }
button.qopt:hover { border-color: var(--accent); background: var(--accent-muted); }
.qopt b { color: var(--fg-muted); min-width: 1.2em; }
.qopt.right { border-color: var(--success); background: var(--success-muted); }
.qopt.wrong { border-color: var(--danger); background: var(--danger-muted); }
.qexp { color: var(--fg-muted); font-size: calc(13px * var(--z)); }
.react-btn { font: inherit; font-size: calc(20px * var(--z)); font-weight: 700; padding: calc(10px * var(--z)) calc(28px * var(--z)); border-radius: 999px; border: 0; cursor: pointer; color: #1a1a1a; background: #f5c518; box-shadow: 0 0 0 4px rgba(245,197,24,.25); }
.react-btn:hover { transform: scale(1.04); }
.react-btn:disabled { opacity: .6; transform: none; }
.react-top { display: flex; gap: 14px; flex-wrap: wrap; font-size: calc(13px * var(--z)); }
.bs-status { margin-bottom: 10px; }
.bs-status .ok { color: var(--success); }
.bs-boards { display: grid; grid-template-columns: repeat(auto-fit, minmax(calc(240px * var(--z)), 1fr)); gap: 18px; }
.bs-cap { margin-bottom: 6px; font-weight: 600; }
.bs-grid { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 3px; max-width: calc(330px * var(--z)); }
.bs-cell { aspect-ratio: 1; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border-muted); display: grid; place-items: center; font-weight: 700; color: var(--fg-muted); padding: 0; font: inherit; }
.bs-cell.ship { background: #3b5b8a; border-color: #4a6fa5; }
.bs-cell.hit { background: var(--danger-muted); border-color: var(--danger); color: var(--danger); }
.bs-cell.ship.hit, .bs-cell.sunk { background: var(--danger); color: #fff; border-color: var(--danger); }
.bs-cell.miss { color: var(--fg-muted); }
.bs-cell.auto { color: var(--fg-subtle); opacity: .6; }
.bs-cell.aim { cursor: crosshair; background: var(--accent-muted); border-color: var(--accent); }
.bs-cell.aim:hover { background: var(--accent); }
.medal { display: inline-block; width: calc(12px * var(--z)); height: calc(12px * var(--z)); border-radius: 50%; margin: 0 3px 0 6px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.medal.r1 { background: #cd7f32; } .medal.r2 { background: #c0c7cf; } .medal.r3 { background: #f5c518; }
.medals { font-size: calc(12px * var(--z)); white-space: nowrap; }
.medals.big { font-size: calc(14px * var(--z)); font-weight: 600; }
.ach-line .text { display: inline-flex; align-items: center; gap: 4px; background: var(--attention-muted); border-color: var(--attention); color: var(--fg); }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(280px * var(--z)), 1fr)); gap: 10px; }
.ach { display: flex; gap: 12px; padding: calc(10px * var(--z)) calc(12px * var(--z)); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.ach-ico { flex: none; width: calc(46px * var(--z)); height: calc(46px * var(--z)); border-radius: 50%; display: grid; place-items: center; font-size: calc(22px * var(--z)); background: var(--surface-2); border: 3px solid var(--border); filter: grayscale(1); opacity: .6; }
.ach.r1 .ach-ico, .ach.r2 .ach-ico, .ach.r3 .ach-ico { filter: none; opacity: 1; }
.ach.r1 .ach-ico { border-color: #cd7f32; } .ach.r2 .ach-ico { border-color: #c0c7cf; } .ach.r3 .ach-ico { border-color: #f5c518; box-shadow: 0 0 0 3px rgba(245,197,24,.2); }
.ach-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin: 6px 0 4px; }
.ach-bar i { display: block; height: 100%; background: var(--accent); }
.ach.r3 .ach-bar i { background: #f5c518; }
.ach-pips { display: flex; gap: 6px; }
.ach-pips .pip { font-size: calc(11px * var(--z)); padding: 0 6px; border-radius: 999px; border: 1px solid var(--border); color: var(--fg-muted); }
.ach-pips .pip.on.r1 { border-color: #cd7f32; color: #cd7f32; } .ach-pips .pip.on.r2 { border-color: #c0c7cf; color: #c0c7cf; } .ach-pips .pip.on.r3 { border-color: #d4a800; color: #d4a800; }
.q-list { display: grid; gap: 4px; max-height: 56vh; overflow: auto; }
.q-row { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border: 1px solid var(--border-muted); border-radius: var(--r); }
.q-row.off { opacity: .55; }
#pin a + a { margin-left: 12px; }

/* ---------- заявка на расход: строки таблицей (как лист «Заявки» в Excel), версии ---------- */
.exp-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.t.exp-t { min-width: calc(1720px * var(--z)); }
.t.exp-t.ro { min-width: calc(1500px * var(--z)); }
.t.exp-t th { font-size: calc(12px * var(--z)); padding: calc(7px * var(--z)) calc(6px * var(--z)); }
.t.exp-t td { padding: calc(4px * var(--z)) calc(5px * var(--z)); vertical-align: top; }
.t.exp-t.ro td { padding: calc(8px * var(--z)) calc(8px * var(--z)); }
.t.exp-t .n { position: sticky; left: 0; z-index: 1; width: calc(34px * var(--z)); text-align: center; color: var(--fg-muted); font-weight: 650; background: var(--surface); box-shadow: inset -1px 0 0 var(--border-muted); }
.t.exp-t thead .n { z-index: 3; background: var(--surface-2); }
.t.exp-t tfoot .n { background: var(--surface-2); }
.t.exp-t td.n { padding-top: calc(11px * var(--z)); }
.t.exp-t [data-f=direction] { min-width: calc(140px * var(--z)); }
.t.exp-t [data-f=department] { min-width: calc(130px * var(--z)); }
.t.exp-t [data-f=category] { min-width: calc(185px * var(--z)); }
.t.exp-t [data-f=tax] { min-width: calc(130px * var(--z)); }
.t.exp-t [data-f=net], .t.exp-t [data-f=gross] { min-width: calc(116px * var(--z)); }
.t.exp-t [data-f=pay_due] { min-width: calc(136px * var(--z)); }
.t.exp-t [data-f=contact_name], .t.exp-t [data-f=contact_phone] { min-width: calc(150px * var(--z)); height: calc(30px * var(--z)); }
.t.exp-t textarea[data-f=description] { min-width: calc(260px * var(--z)); min-height: calc(32px * var(--z)); height: auto; padding-top: calc(6px * var(--z)); resize: vertical; field-sizing: content; max-height: calc(220px * var(--z)); }
.t.exp-t td.coef { padding-top: calc(11px * var(--z)); color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.t.exp-t td.desc { white-space: pre-wrap; min-width: calc(260px * var(--z)); }
.t.exp-t td.acts { padding-top: calc(5px * var(--z)); }
.t.exp-t tr.field-invalid { outline: none; }
.t.exp-t tr.field-invalid > td { background: var(--danger-muted); }
.t.exp-t tr.field-invalid > td.n { color: var(--danger); }
.t.exp-t tfoot td { font-variant-numeric: tabular-nums; }
.exp-wrap.field-invalid { outline-offset: 2px; }
.cp-cell { position: relative; min-width: calc(190px * var(--z)); }
.cp-cell .input { padding-right: calc(28px * var(--z)); }
.cp-mark { display: inline-grid; place-items: center; width: calc(17px * var(--z)); height: calc(17px * var(--z)); border-radius: 50%; font-size: calc(10px * var(--z)); font-weight: 700; vertical-align: -3px; }
.cp-cell .cp-mark { position: absolute; right: calc(7px * var(--z)); top: calc(8px * var(--z)); }
.cp-mark:empty { display: none; }
.cp-mark.ok { color: var(--success); background: var(--success-muted); }
.cp-mark.txt { color: var(--fg-muted); background: var(--surface-2); border: 1px solid var(--border); }
.ver-chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 calc(8px * var(--z)); border: 1px solid var(--border); border-radius: 2em; background: var(--surface); color: var(--accent); font: inherit; font-size: calc(12px * var(--z)); line-height: calc(20px * var(--z)); cursor: pointer; }
.ver-chip:hover { background: var(--accent-muted); border-color: var(--accent); }
.vers > .sec-head { display: flex; align-items: center; gap: 8px; }
.vers > .sec-head h3 { flex: 1; }
.vers.closed > .sec-head { border-bottom-color: transparent; border-radius: var(--r); }
.vers.closed > .sec-head .chev { transform: rotate(-90deg); }
.vers.closed > .hist-body { display: none; }
.ver-list { display: grid; gap: 0; max-height: calc(360px * var(--z)); overflow-y: auto; }
.ver-it { padding: calc(9px * var(--z)) 0; border-top: 1px solid var(--border-muted); font-variant-numeric: tabular-nums; }
.ver-it:first-child { border-top: 0; }
.ver-it .c { margin-top: calc(4px * var(--z)); padding: calc(6px * var(--z)) calc(9px * var(--z)); border-radius: var(--r); background: var(--surface-2); white-space: pre-wrap; }
.delta-up { color: var(--danger); font-weight: 600; }
.delta-down { color: var(--success); font-weight: 600; }
.diff-t tr.money td:first-child { box-shadow: inset 3px 0 0 var(--attention); }
.label.orange { color: var(--attention); border-color: currentColor; background: var(--attention-muted); }
@media print { .t.exp-t { min-width: 0; font-size: 10px; } .exp-wrap { overflow: visible; } }
.t tr.dep-head td { background: var(--surface-2); padding-top: calc(6px * var(--z)); padding-bottom: calc(6px * var(--z)); }
.lay-zone > [data-win].sec.exp-fs { position: fixed; inset: calc(12px * var(--z)); z-index: 50; margin: 0; display: flex; flex-direction: column; box-shadow: 0 24px 80px rgba(0,0,0,.55); animation: popIn .15s var(--ease); }
.sec.exp-fs > .sec-head { pointer-events: none; }
.sec.exp-fs > .sec-head .chev { visibility: hidden; }
.sec.exp-fs > .sec-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sec.exp-fs > .sec-body > .box-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: calc(12px * var(--z)) !important; }
.sec.exp-fs .exp-wrap { flex: 1; min-height: 0; overflow: auto; }
.sec.exp-fs .exp-t thead th { position: sticky; top: 0; z-index: 2; }
.sec.exp-fs .exp-t thead th.n { z-index: 4; }
body.exp-fs-on { overflow: hidden; }
.diff-t td.was, .diff-t td.now { width: 33%; }
.money-bar { display: inline-block; width: 3px; height: 12px; background: var(--attention); vertical-align: -1px; border-radius: 2px; }
.dup-notice { margin-bottom: calc(12px * var(--z)); }
.dup-list { display: grid; gap: calc(6px * var(--z)); margin-top: calc(8px * var(--z)); }
.dup-it { display: flex; gap: calc(10px * var(--z)); align-items: flex-start; padding: calc(7px * var(--z)) calc(9px * var(--z)); border-radius: var(--r); background: var(--surface); border: 1px solid var(--border-muted); }
.t.exp-t tr.has-dup > td.n { color: var(--attention); box-shadow: inset 3px 0 0 var(--attention), inset -1px 0 0 var(--border-muted); }
.appr-note { display: flex; gap: 6px; align-items: flex-start; line-height: 1.4; }
.appr-note svg { flex: none; margin-top: 2px; }

/* ---------- замечания и предложения ---------- */
.fb-kinds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: calc(8px * var(--z)); }
.fb-kind { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: calc(10px * var(--z)) 6px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); color: var(--fg-muted); font: inherit; font-weight: 600; cursor: pointer; transition: border-color .12s, background .12s; }
.fb-kind .e { font-size: calc(24px * var(--z)); line-height: 1; }
.fb-kind:hover { color: var(--fg); border-color: var(--fg-subtle); }
.fb-kind.on { color: var(--fg); border-color: var(--accent); background: var(--accent-muted); box-shadow: 0 0 0 1px var(--accent) inset; }
.fb-imp { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
.fb-imp button { justify-content: center; text-align: center; white-space: normal; line-height: 1.2; min-height: calc(32px * var(--z)); padding: 3px 6px; }
@media (max-width: 640px) { .fb-kinds { grid-template-columns: repeat(2, 1fr); } .fb-imp { flex-wrap: wrap; } }
.fb-drop { display: flex; align-items: center; gap: 10px; padding: calc(14px * var(--z)); border: 1px dashed var(--border); border-radius: var(--r-lg); color: var(--fg-muted); background: var(--bg-inset); cursor: default; }
.fb-drop.over, .fb-drop:focus { border-color: var(--accent); background: var(--accent-muted); outline: none; }
.fb-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-thumbs:empty { display: none; }
.fb-thumb { position: relative; width: calc(110px * var(--z)); height: calc(76px * var(--z)); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface-2); display: grid; place-items: center; }
.fb-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fb-thumb .fn { font-size: calc(11px * var(--z)); padding: 4px; text-align: center; word-break: break-all; }
.fb-thumb .x { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; display: grid; place-items: center; cursor: pointer; }
.fb-ctx summary { cursor: pointer; }
.fb-done { text-align: center; padding: calc(20px * var(--z)) 0; }
.fb-done .e { font-size: calc(44px * var(--z)); }
.fb-done h3 { margin: 10px 0 6px; }
.fb-queue { margin-bottom: calc(14px * var(--z)); align-items: center; }
.fb-list { overflow: hidden; }
.fb-row { display: flex; align-items: center; gap: calc(12px * var(--z)); padding: calc(11px * var(--z)) calc(14px * var(--z)); border-top: 1px solid var(--border-muted); color: var(--fg); text-decoration: none; }
.fb-row:first-child { border-top: 0; }
.fb-row:hover { background: var(--hover); }
.fb-e { font-size: calc(20px * var(--z)); line-height: 1; flex: none; width: calc(26px * var(--z)); text-align: center; }
.fb-e.big { font-size: calc(26px * var(--z)); margin-right: 8px; vertical-align: -2px; }
.fb-t { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-m { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-m svg { vertical-align: -2px; }
.fb-vote { flex: none; min-width: calc(52px * var(--z)); padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); color: var(--fg-muted); font: inherit; font-size: calc(12px * var(--z)); cursor: pointer; }
.fb-vote:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.fb-vote.on { border-color: var(--accent); background: var(--accent-muted); color: var(--accent); }
.fb-vote:disabled { opacity: .55; cursor: default; }
.fb-vote-big.on { border-color: var(--accent); background: var(--accent-muted); color: var(--accent); }
.label.imp-high { color: var(--danger); border-color: currentColor; background: var(--danger-muted); }
.label.imp-mid { color: var(--attention); border-color: currentColor; }
.label.imp-low { color: var(--fg-muted); }
@media (max-width: 700px) { .fb-row .label { display: none; } .fb-row .label:last-of-type { display: inline-flex; } }
.fb-body { white-space: pre-wrap; line-height: 1.5; overflow-wrap: anywhere; }
.fb-body.lg { font-size: calc(15px * var(--z)); }
.fb-shots { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-shot { display: block; width: calc(180px * var(--z)); height: calc(120px * var(--z)); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface-2); }
.fb-shot img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s var(--ease); }
.fb-shot:hover img { transform: scale(1.04); }
.fb-file { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--r); }
.fb-ctxline svg { vertical-align: -2px; }
.fb-timeline { display: grid; gap: calc(10px * var(--z)); margin-bottom: calc(14px * var(--z)); }
.fb-msg { display: flex; gap: 10px; align-items: flex-start; }
.fb-msg .fb-body { margin-top: 4px; padding: calc(8px * var(--z)) calc(11px * var(--z)); border-radius: var(--r); background: var(--surface-2); }
.fb-msg.claude .fb-body { background: var(--done-muted); border: 1px solid color-mix(in srgb, var(--done) 35%, transparent); }
.fb-msg .label { vertical-align: 1px; }
.fb-ev { padding-left: calc(38px * var(--z)); }
.claude-av { display: inline-grid; place-items: center; width: calc(28px * var(--z)); height: calc(28px * var(--z)); border-radius: 50%; background: #d97757; color: #fff; font-weight: 700; flex: none; font-size: calc(13px * var(--z)); }
h3 .claude-av { width: 22px; height: 22px; font-size: 11px; margin-right: 6px; vertical-align: -1px; }
.fb-plan { border-color: color-mix(in srgb, var(--done) 45%, var(--border)); }
.fb-cmt { display: grid; gap: 8px; }
.fb-acts .btn { justify-content: flex-start; }
.fb-howto { padding: 0 4px; line-height: 1.45; }
.fb-howto svg { vertical-align: -2px; }


/* =====================================================================
   Стили оформления (Профиль → Интерфейс → Стиль): «Классика» — всё, что выше;
   «Сцена» и «Офис» меняют форму кнопок, меню, блоков и акцент. Работают с любой темой (чёрная, серая, белая).
   ===================================================================== */

/* ---------- «Сцена»: мягкие формы, кнопки-таблетки, тёплый «прожекторный» акцент ---------- */
:root[data-style="stage"] {
  --r: calc(10px * var(--z));
  --r-lg: calc(18px * var(--z));
  --accent: #fb923c;
  --accent-muted: rgba(251, 146, 60, .16);
  --stage-grad: linear-gradient(120deg, #f97316 0%, #e11d48 55%, #a21caf 100%);
  --tab-line: var(--stage-grad);
  --tab-line-color: #f97316;
}
:root[data-style="stage"][data-theme="light"] { --accent: #c2410c; --accent-muted: rgba(194, 65, 12, .09); }
:root[data-style="stage"] body {
  background: radial-gradient(calc(1100px * var(--z)) calc(420px * var(--z)) at 8% -12%, rgba(249, 115, 22, .10), transparent 62%),
              radial-gradient(calc(900px * var(--z)) calc(380px * var(--z)) at 96% -8%, rgba(168, 85, 247, .10), transparent 62%), var(--bg);
  background-attachment: fixed;
}
:root[data-style="stage"] .page-head h1 { font-size: calc(27px * var(--z)); font-weight: 750; letter-spacing: -.025em; }
:root[data-style="stage"] h2, :root[data-style="stage"] h3 { font-weight: 700; }
:root[data-style="stage"] .app-header { border-bottom-color: transparent; }
:root[data-style="stage"] .app-header::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--stage-grad); opacity: .8; pointer-events: none; }
:root[data-style="stage"] .gsearch input { border-radius: 999px; background: var(--surface-2); border-color: var(--border-muted); }
:root[data-style="stage"] .gsearch input:focus { border-color: var(--accent); outline: none; }
:root[data-style="stage"] .hbtn { border-radius: 999px; border-color: var(--border-muted); background: var(--surface-2); }
:root[data-style="stage"] .hbtn .dot, :root[data-style="stage"] .counter.blue { background: var(--stage-grad); color: #fff; }
/* меню — «таблетки», активный пункт подсвечен как луч */
:root[data-style="stage"] .app-nav ul { gap: 4px; }
:root[data-style="stage"] .app-nav a { padding: 0 calc(12px * var(--z)); }
:root[data-style="stage"] .app-nav a::before { border-radius: 999px; inset: calc(8px * var(--z)) 0; }
:root[data-style="stage"][data-nav="left"] .app-nav a::before, :root[data-style="stage"][data-nav="right"] .app-nav a::before { inset: 2px 0; }
:root[data-style="stage"][data-nav="bottom"] .app-nav a::before { border-radius: var(--r-lg); inset: calc(6px * var(--z)) 2px; }
:root[data-style="stage"] .app-nav a.on { color: var(--accent); }
:root[data-style="stage"] .app-nav a.on .icon { color: var(--accent); }
:root[data-style="stage"] .app-nav a.on::before { background: var(--accent-muted); }
:root[data-style="stage"] .app-nav a.on::after { display: none; }
/* кнопки — таблетки, главная — градиентом */
:root[data-style="stage"] .btn { border-radius: 999px; padding: 0 calc(16px * var(--z)); border-color: transparent; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border-muted); }
:root[data-style="stage"] .btn:hover { background: var(--hover); box-shadow: inset 0 0 0 1px var(--border); }
:root[data-style="stage"] .btn.sm { padding: 0 calc(12px * var(--z)); }
:root[data-style="stage"] .btn.icon-only { padding: 0; }
:root[data-style="stage"] .btn.primary { background: var(--stage-grad); color: #fff; box-shadow: 0 calc(4px * var(--z)) calc(16px * var(--z)) rgba(225, 29, 72, .28); }
:root[data-style="stage"] .btn.primary:hover { background: var(--stage-grad); filter: brightness(1.08); }
:root[data-style="stage"] .btn.green { background: linear-gradient(120deg, #16a34a, #0d9488); color: #fff; box-shadow: 0 calc(4px * var(--z)) calc(14px * var(--z)) rgba(22, 163, 74, .25); }
:root[data-style="stage"] .btn.green:hover { filter: brightness(1.08); }
:root[data-style="stage"] .btn.danger:hover { background: var(--danger); color: #fff; }
:root[data-style="stage"] .btn.ghost { background: transparent; box-shadow: none; }
:root[data-style="stage"] .btn.ghost:hover { background: var(--hover); }
:root[data-style="stage"] .btn-group .btn:first-child { border-radius: 999px 0 0 999px; }
:root[data-style="stage"] .btn-group .btn:last-child { border-radius: 0 999px 999px 0; }
:root[data-style="stage"] .btn-group .btn.on { background: var(--accent-muted); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
/* блоки — крупное скругление, мягкая тень */
:root[data-style="stage"] .box, :root[data-style="stage"] .table-wrap { border-color: var(--border-muted); box-shadow: 0 calc(12px * var(--z)) calc(32px * var(--z)) calc(-20px * var(--z)) rgba(0, 0, 0, .45); }
:root[data-style="stage"][data-theme="light"] .box, :root[data-style="stage"][data-theme="light"] .table-wrap { box-shadow: 0 calc(10px * var(--z)) calc(28px * var(--z)) calc(-18px * var(--z)) rgba(31, 35, 40, .22); }
:root[data-style="stage"] .box-head { background: transparent; border-bottom-color: var(--border-muted); }
:root[data-style="stage"] .t thead th { background: transparent; }
/* вкладки страниц — переключатель-сегменты */
:root[data-style="stage"] .tabs { border-bottom: 0; gap: 2px; padding: calc(4px * var(--z)); background: var(--bg-inset); border: 1px solid var(--border-muted); border-radius: var(--r-lg); width: fit-content; max-width: 100%; }
:root[data-style="stage"] .tabs button { border-radius: 999px; padding: calc(6px * var(--z)) calc(14px * var(--z)); }
:root[data-style="stage"] .tabs button.on { background: var(--surface); box-shadow: 0 1px calc(3px * var(--z)) rgba(0, 0, 0, .25), inset 0 0 0 1px var(--border-muted); }
:root[data-style="stage"] .tabs button.on::after { display: none; }
:root[data-style="stage"] .label { border-radius: 999px; }
:root[data-style="stage"] .seg { border-radius: 999px; }

/* ---------- «Офис»: строгий деловой стиль — цветная шапка, прямые углы, плотные таблицы ---------- */
:root[data-style="office"] {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Roboto, Arial, sans-serif;
  --r: calc(3px * var(--z));
  --r-lg: calc(4px * var(--z));
  --header: #0e2a36;
  --header-fg: #e6f3f6;
  --header-muted: rgba(230, 243, 246, .66);
  --header-hover: rgba(255, 255, 255, .08);
  --header-line: #2dd4bf;
  --accent: #2dd4bf;
  --accent-muted: rgba(45, 212, 191, .14);
  --primary-bg: #0d9488;
  --primary-fg: #ffffff;
  --primary-hover: #0f766e;
  --tab-line: #2dd4bf;
  --tab-line-color: #2dd4bf;
}
:root[data-style="office"][data-theme="gray"] { --header: #15394a; }
:root[data-style="office"][data-theme="light"] {
  --header: #0f4c5c; --header-line: #5eead4;
  --accent: #0f766e; --accent-muted: rgba(15, 118, 110, .09);
  --primary-bg: #0f766e; --primary-hover: #115e59; --tab-line: #0f766e; --tab-line-color: #0f766e;
}
:root[data-style="office"] .app-header { border-bottom: 0; box-shadow: 0 1px 0 rgba(0, 0, 0, .25); }
:root[data-style="office"] .app-header .brand img { filter: none; }
:root[data-style="office"] .brand .product { color: var(--header-muted); }
:root[data-style="office"] .brand .divider { background: rgba(255, 255, 255, .2); }
:root[data-style="office"] .gsearch input { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16); color: var(--header-fg); }
:root[data-style="office"] .gsearch input::placeholder, :root[data-style="office"] .gsearch > .icon { color: var(--header-muted); }
:root[data-style="office"] .gsearch input:focus { outline: none; border-color: var(--header-line); background: rgba(255, 255, 255, .12); }
:root[data-style="office"] .gsearch kbd { background: transparent; color: var(--header-muted); border-color: rgba(255, 255, 255, .2); }
:root[data-style="office"] .hbtn { border-color: rgba(255, 255, 255, .18); color: var(--header-muted); }
:root[data-style="office"] .hbtn:hover { color: var(--header-fg); background: var(--header-hover); }
:root[data-style="office"] .hbtn .dot { background: #e5534b; color: #fff; }
:root[data-style="office"] .counter.blue { background: var(--primary-bg); color: #fff; }
/* меню — заглавными буквами на цветной полосе */
:root[data-style="office"] .app-nav a { color: var(--header-muted); font-size: calc(12px * var(--z)); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
:root[data-style="office"] .app-nav a .icon { color: inherit; opacity: .85; }
:root[data-style="office"] .app-nav a:hover { color: var(--header-fg); }
:root[data-style="office"] .app-nav a:hover::before { background: var(--header-hover); }
:root[data-style="office"] .app-nav a::before { border-radius: var(--r); }
:root[data-style="office"] .app-nav a.on { color: #fff; }
:root[data-style="office"] .app-nav a.on .icon { color: #fff; opacity: 1; }
:root[data-style="office"] .app-nav a.on::after { background: var(--header-line); height: 3px; border-radius: 0; left: 0; right: 0; }
:root[data-style="office"][data-nav="left"] .app-nav a.on::before, :root[data-style="office"][data-nav="right"] .app-nav a.on::before { background: var(--header-hover); }
:root[data-style="office"][data-nav="left"] .app-nav a.on::after, :root[data-style="office"][data-nav="right"] .app-nav a.on::after { width: 3px; height: auto; }
:root[data-style="office"][data-nav="left"] .app-nav, :root[data-style="office"][data-nav="right"] .app-nav, :root[data-style="office"][data-nav="bottom"] .app-nav { border-color: transparent; }
:root[data-style="office"] .app-nav .counter { background: rgba(255, 255, 255, .14); color: #fff; border-color: transparent; }
/* кнопки — прямоугольные, главная — сплошной заливкой */
:root[data-style="office"] .btn { font-weight: 600; background: var(--surface); box-shadow: 0 1px 0 rgba(0, 0, 0, .06); }
:root[data-style="office"] .btn:active { transform: none; }
:root[data-style="office"] .btn.primary { background: var(--primary-bg); color: var(--primary-fg); }
:root[data-style="office"] .btn.primary:hover { background: var(--primary-hover); }
:root[data-style="office"] .btn.ghost { background: transparent; box-shadow: none; }
/* блоки — заголовки заглавными, без заливки */
:root[data-style="office"] .page-head h1 { font-weight: 600; font-size: calc(22px * var(--z)); letter-spacing: 0; }
:root[data-style="office"] .box-head { background: var(--surface); border-bottom: 2px solid var(--border-muted); }
:root[data-style="office"] .box-head h2, :root[data-style="office"] .box-head h3 { font-size: calc(12.5px * var(--z)); text-transform: uppercase; letter-spacing: .06em; color: var(--fg-muted); font-weight: 700; }
:root[data-style="office"] .box-head h2 .counter, :root[data-style="office"] .box-head h3 .counter { text-transform: none; letter-spacing: 0; }
/* таблицы — заголовки заглавными, строки «зеброй» */
:root[data-style="office"] .t thead th { text-transform: uppercase; letter-spacing: .04em; font-size: calc(11px * var(--z)); }
:root[data-style="office"] :where(.t tbody tr:nth-child(even)) > td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
:root[data-style="office"] .tabs button.on::after { height: 3px; border-radius: 0; left: 0; right: 0; }
:root[data-style="office"] .label { border-radius: var(--r); }

/* ---------- превью стилей в «Профиль → Интерфейс» (рисуются одинаково при любом выбранном стиле) ---------- */
.sp { height: calc(96px * var(--z)); border-radius: 6px; border: 1px solid var(--border-muted); overflow: hidden; display: grid; grid-template-rows: 14px 12px 1fr; background: var(--bg); }
.sp .h { background: var(--bg-inset); display: flex; align-items: center; gap: 4px; padding: 0 6px; }
.sp .h i { width: 18px; height: 4px; border-radius: 2px; background: var(--fg-subtle); opacity: .7; }
.sp .n { background: var(--bg-inset); display: flex; gap: 4px; padding: 0 6px; align-items: center; border-bottom: 1px solid var(--border-muted); }
.sp .n i { width: 16px; height: 4px; border-radius: 2px; background: var(--fg-subtle); opacity: .55; position: relative; }
.sp .n i.on { background: var(--fg); opacity: .9; }
.sp .n i.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px; background: #fd8c73; }
.sp .c { padding: 7px; display: grid; gap: 6px; align-content: start; }
.sp .card { height: 26px; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; }
.sp .bt { display: flex; gap: 5px; }
.sp .bt i { width: 30px; height: 11px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--border); }
.sp .bt i.p { background: var(--fg); opacity: .9; border-color: transparent; }
.sp.stage { background: radial-gradient(120px 50px at 10% 0, rgba(249, 115, 22, .2), transparent), var(--bg); }
.sp.stage .n { border-bottom: 0; box-shadow: inset 0 -2px 0 #e11d48; }
.sp.stage .n i.on { width: 20px; height: 7px; border-radius: 99px; background: rgba(251, 146, 60, .35); }
.sp.stage .n i.on::after { display: none; }
.sp.stage .card { border-radius: 9px; border-color: var(--border-muted); box-shadow: 0 6px 12px -8px rgba(0, 0, 0, .5); }
.sp.stage .bt i { border-radius: 99px; border-color: transparent; }
.sp.stage .bt i.p { background: linear-gradient(120deg, #f97316, #e11d48 55%, #a21caf); opacity: 1; }
.sp.office { grid-template-rows: 14px 12px 1fr; }
.sp.office .h, .sp.office .n { background: #0f4c5c; border-bottom: 0; }
.sp.office .h i, .sp.office .n i { background: rgba(255, 255, 255, .55); border-radius: 0; height: 3px; }
.sp.office .n i.on { background: #fff; }
.sp.office .n i.on::after { background: #2dd4bf; height: 2px; bottom: -4px; }
.sp.office .card { border-radius: 1px; border-top: 2px solid var(--border); }
.sp.office .bt i { border-radius: 1px; }
.sp.office .bt i.p { background: #0d9488; opacity: 1; }
.ui-opts.wide { grid-template-columns: repeat(auto-fill, minmax(calc(240px * var(--z)), 1fr)); }
:root[data-style="office"][data-nav="top"] .app-nav a .icon { display: none; }
:root[data-style="office"][data-nav="top"] .app-nav a { padding: 0 calc(10px * var(--z)); letter-spacing: .045em; }

/* ---------- Файлы (файловый обменник) ---------- */
main#view.wide .fx { max-width: calc(1560px * var(--z)); margin: 0 auto; }
.fx { display: grid; grid-template-columns: calc(236px * var(--z)) minmax(0, 1fr); gap: calc(24px * var(--z)); align-items: start; }
.fx-side { position: sticky; top: calc(var(--shell-top) + calc(16px * var(--z))); display: grid; gap: calc(12px * var(--z)); }
.fx-new { width: 100%; }
.fx-nav { display: grid; gap: 1px; }
.fx-nav a { display: flex; align-items: center; gap: calc(10px * var(--z)); padding: calc(7px * var(--z)) calc(10px * var(--z)); border-radius: var(--r); color: var(--fg-muted); font-weight: 500; }
.fx-nav a:hover { background: var(--hover); color: var(--fg); text-decoration: none; }
.fx-nav a.on { background: var(--accent-muted); color: var(--fg); font-weight: 600; }
.fx-nav a.on .icon { color: var(--accent); }
.fx-nav hr { border: 0; border-top: 1px solid var(--border-muted); margin: 6px 0; width: 100%; }
.fx-usage { padding: 0 calc(10px * var(--z)); }
.fx-usage .icon { vertical-align: -2px; }
.fx-main { position: relative; min-width: 0; min-height: 60vh; }
.fx-top { display: flex; align-items: center; gap: calc(10px * var(--z)); margin-bottom: calc(12px * var(--z)); flex-wrap: wrap; }
.fx-crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-size: calc(18px * var(--z)); font-weight: 650; min-width: 0; }
.fx-crumbs.small { font-size: calc(13px * var(--z)); font-weight: 500; gap: 4px; }
.fx-crumb { color: var(--fg-muted); padding: 2px 6px; border-radius: var(--r); }
.fx-crumb:hover { background: var(--hover); color: var(--fg); text-decoration: none; }
.fx-crumb.on { color: var(--fg); }
.fx-crumbs .sep { color: var(--fg-subtle); display: inline-flex; }
.fx-crumbs .btn { margin-left: 6px; }
.fx-search { width: calc(250px * var(--z)); }
.fx-viewsw button { padding: calc(5px * var(--z)) calc(9px * var(--z)); }
.fx-hint { margin-bottom: calc(12px * var(--z)); }
.fx-hint:empty { display: none; }
.fx-selbar { position: sticky; top: calc(var(--shell-top) + 6px); z-index: 6; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 12px; margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--accent); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.fx-t td { padding-top: calc(7px * var(--z)); padding-bottom: calc(7px * var(--z)); }
.fx-t th.ck, .fx-t td.ck { width: calc(34px * var(--z)); padding-right: 0; }
.fx-t .ck input { width: 15px; height: 15px; accent-color: var(--accent); }
.fx-t tbody tr:hover { background: var(--hover); }
.fx-t tr.sel > td { background: var(--accent-muted); }
.fx-nm { display: flex; align-items: center; gap: calc(12px * var(--z)); cursor: pointer; min-width: 0; }
.fx-n { font-weight: 550; overflow-wrap: anywhere; }
.fx-nm:hover .fx-n { color: var(--accent); }
.fx-sub { display: block; margin-top: 1px; }
.fx-mark { color: var(--fg-subtle); margin-left: 6px; display: inline-flex; vertical-align: -1px; }
.fx-mark.fav { color: #e3b341; }
.fx-mark.link { color: var(--accent); }
.fx-acts .btn { opacity: .5; }
.fx-t tr:hover .fx-acts .btn, .fx-acts .btn:focus-visible { opacity: 1; }
.fx-t tr.dim { opacity: .55; }
.danger-t { color: var(--danger); }
/* значки файлов и папок */
.fi { position: relative; display: inline-grid; place-items: center; flex: none; width: calc(30px * var(--z)); height: calc(30px * var(--z)); }
.fi.folder svg { width: 100%; height: 100%; }
.fi.folder .b { fill: #3b82c4; }
.fi.folder .f { fill: #54aeff; }
:root[data-theme="light"] .fi.folder .b { fill: #4f94d4; }
:root[data-theme="light"] .fi.folder .f { fill: #79b8ff; }
.fi.file { width: calc(24px * var(--z)); height: calc(30px * var(--z)); border-radius: 3px calc(8px * var(--z)) 3px 3px; background: color-mix(in srgb, var(--c) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 50%, transparent); }
.fi.file b { font-size: calc(7.5px * var(--z)); font-weight: 800; color: var(--c); letter-spacing: .02em; font-family: var(--font); }
.fi.big { width: calc(64px * var(--z)); height: calc(64px * var(--z)); }
.fi.file.big { width: calc(50px * var(--z)); height: calc(62px * var(--z)); border-radius: 5px calc(14px * var(--z)) 5px 5px; }
.fi.file.big b { font-size: calc(13px * var(--z)); }
.fi-sub { position: absolute; right: -3px; bottom: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; color: var(--fg-muted); box-shadow: 0 0 0 1px var(--border); }
.fi.big .fi-sub { width: 20px; height: 20px; }
/* плитка */
.fx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(150px * var(--z)), 1fr)); gap: calc(12px * var(--z)); }
.fx-card { position: relative; border: 1px solid var(--border-muted); border-radius: var(--r-lg); background: var(--surface); padding: calc(8px * var(--z)); display: grid; gap: 6px; }
.fx-card:hover { border-color: var(--border); }
.fx-card.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.fx-thumb { height: calc(108px * var(--z)); border-radius: var(--r); background: var(--bg-inset); display: grid; place-items: center; overflow: hidden; cursor: pointer; }
.fx-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fx-cname { font-weight: 550; font-size: calc(13px * var(--z)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; padding: 0 2px; }
.fx-cmeta { padding: 0 2px; }
.fx-cmeta .fx-mark { margin: 0 4px 0 0; }
.fx-ck { position: absolute; top: 12px; left: 12px; z-index: 2; opacity: 0; }
.fx-ck input { width: 16px; height: 16px; accent-color: var(--accent); }
.fx-card:hover .fx-ck, .fx-card.sel .fx-ck { opacity: 1; }
.fx-dots { position: absolute; top: 10px; right: 10px; z-index: 2; opacity: 0; background: var(--surface) !important; }
.fx-card:hover .fx-dots { opacity: 1; }
.fx-empty { border: 1px dashed var(--border); border-radius: var(--r-lg); }
/* перетаскивание */
.fx-drop { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--bg) 82%, transparent); pointer-events: none; }
.fx-drop > div { display: grid; justify-items: center; gap: 6px; color: var(--accent); font-size: calc(15px * var(--z)); position: sticky; top: 40vh; }
/* окно загрузки */
.fx-up { position: fixed; right: calc(20px * var(--z)); bottom: calc(20px * var(--z)); z-index: 80; width: min(calc(370px * var(--z)), calc(100vw - 24px)); max-height: 50vh; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
:root[data-nav="bottom"] .fx-up { bottom: calc(var(--bnav-h) + 16px); }
.fx-up.min .fx-up-list { display: none; }
.fx-up-head { display: flex; align-items: center; gap: 6px; padding: 9px 10px 9px 14px; border-bottom: 1px solid var(--border-muted); }
.fx-up-list { overflow: auto; }
.fx-up-it { position: relative; display: flex; gap: 8px; align-items: center; padding: 7px 12px 7px 14px; border-top: 1px solid var(--border-muted); font-size: calc(13px * var(--z)); }
.fx-up-it:first-child { border-top: 0; }
.fx-up-it .bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); transition: width .2s; }
.fx-up-it.done .icon { color: var(--success); }
.fx-up-it.cancel { opacity: .55; }
/* просмотр файла */
.modal.fx-pv-modal { width: min(calc(1120px * var(--z)), 100%); }
.fx-pv { position: relative; }
.fx-pv-stage { height: 70vh; display: grid; place-items: center; background: var(--bg-inset); border-radius: var(--r); overflow: hidden; }
.fx-pv-stage img, .fx-pv-stage video { max-width: 100%; max-height: 70vh; object-fit: contain; }
.fx-pv-stage iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.fx-pv-na { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 20px; }
.fx-pv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 58px; border: 0; border-radius: var(--r); background: rgba(0, 0, 0, .45); color: #fff; display: grid; place-items: center; }
.fx-pv-nav:hover { background: rgba(0, 0, 0, .65); }
.fx-pv-nav.prev { left: 8px; }
.fx-pv-nav.next { right: 8px; }
/* поделиться */
.fx-link { border: 1px solid var(--border); border-radius: var(--r-lg); padding: calc(10px * var(--z)) calc(12px * var(--z)); display: grid; gap: 8px; background: var(--surface); }
.fx-link.fresh { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.fx-link.dim { opacity: .6; }
.fx-url { display: flex; gap: 6px; flex-wrap: wrap; }
.fx-url .input { flex: 1 1 260px; min-width: 0; font-size: calc(12px * var(--z)); }
.fx-lform { border: 1px solid var(--accent); border-radius: var(--r-lg); padding: calc(14px * var(--z)); background: var(--surface-2); gap: 12px; }
.fx-perms { display: grid; gap: 6px; }
.fx-pubwarn { margin: 8px 0; }
.fx-pubwarn code { font-size: 12px; }
.fx-mv { max-height: 320px; overflow: auto; margin-top: 8px; }
@media (max-width: 900px) {
  .fx { grid-template-columns: 1fr; }
  .fx-side { position: static; }
  .fx-nav { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; }
  .fx-nav hr { display: none; }
  .fx-search { width: 100%; }
  .fx-t th:nth-child(4), .fx-t td:nth-child(4) { display: none; }
}

/* ---------- страница «Файлов» для заказчика (/s/<ссылка>) ---------- */
.sh-body { min-height: 100vh; display: flex; flex-direction: column;
  background: radial-gradient(calc(900px * var(--z)) calc(380px * var(--z)) at 15% -10%, var(--glow-1), transparent 60%),
              radial-gradient(calc(800px * var(--z)) calc(360px * var(--z)) at 90% -10%, var(--glow-2), transparent 60%), var(--bg); }
.sh-head { display: flex; align-items: center; gap: 12px; padding: 18px 24px; }
.sh-logo { height: 30px; filter: var(--logo-filter); }
.sh-sep { width: 1px; height: 22px; background: var(--border); }
.sh-main { flex: 1; width: 100%; max-width: 920px; margin: 0 auto; padding: 16px 16px 40px; display: grid; gap: 12px; align-content: start; }
.sh-foot { text-align: center; padding: 18px 16px 24px; }
.sh-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 22px; display: grid; gap: 16px; box-shadow: 0 12px 40px -24px rgba(0, 0, 0, .5); }
.sh-center { justify-items: center; text-align: center; padding: 40px 22px; }
.sh-center h2 { font-size: 20px; }
.sh-center p { margin: 0; max-width: 460px; }
.sh-err { color: var(--danger); min-height: 18px; }
.sh-title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sh-title h1 { margin: 0; font-size: 22px; font-weight: 650; overflow-wrap: anywhere; }
.sh-who { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.sh-who .icon { vertical-align: -2px; }
.sh-big { height: 40px; padding: 0 18px; font-size: 15px; }
.sh-crumbs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; color: var(--fg-muted); }
.sh-file { display: grid; place-items: center; background: var(--bg-inset); border-radius: var(--r); min-height: 160px; overflow: hidden; }
.sh-img { max-width: 100%; max-height: 65vh; display: block; }
.sh-pdf { width: 100%; height: 70vh; border: 0; background: #fff; }
.sh-t td { padding-top: 9px; padding-bottom: 9px; }
.sh-t tr:first-child td { border-top: 0; }
.sh-selbar { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--accent); border-radius: var(--r); background: var(--accent-muted); }
.sh-up { display: grid; gap: 10px; border-top: 1px solid var(--border-muted); padding-top: 16px; }
.sh-drop { display: grid; justify-items: center; gap: 6px; padding: 26px 16px; border: 2px dashed var(--border); border-radius: var(--r-lg); text-align: center; color: var(--fg-muted); }
.sh-drop b { color: var(--fg); font-size: 15px; }
.sh-drop.over { border-color: var(--accent); background: var(--accent-muted); color: var(--accent); }
.sh-uplist:empty { display: none; }
.sh-uplist { border: 1px solid var(--border-muted); border-radius: var(--r); overflow: hidden; }
.sh-pv { position: fixed; inset: 0; z-index: 100; background: rgba(1, 4, 9, .85); display: grid; grid-template-rows: 1fr auto; padding: 16px; gap: 10px; }
.sh-pv-in { display: grid; place-items: center; min-height: 0; }
.sh-pv-in img, .sh-pv-in video { max-width: 100%; max-height: calc(100vh - 100px); object-fit: contain; }
.sh-pv-in iframe { width: min(1000px, 100%); height: calc(100vh - 100px); border: 0; background: #fff; border-radius: 6px; }
.sh-pv-bar { display: flex; gap: 8px; align-items: center; color: #fff; max-width: 1000px; width: 100%; margin: 0 auto; }
@media (max-width: 600px) { .sh-card { padding: 16px; } .sh-title h1 { font-size: 18px; } .sh-big { width: 100%; } .sh-t td:first-child { display: none; } }
.t td.right, .t th.right { text-align: right; }

/* ---------- 0.24: файлы в чате, настройки «Файлов» ---------- */
.chat-main { position: relative; }
.ch-drop { position: absolute; inset: calc(8px * var(--z)); z-index: 15; display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--bg) 85%, transparent); pointer-events: none; }
.ch-drop > div { display: grid; justify-items: center; gap: 6px; color: var(--accent); font-size: calc(15px * var(--z)); }
.ch-drop span { color: var(--fg-muted); font-size: calc(13px * var(--z)); }
.composer .att-btn { padding: calc(4px * var(--z)); color: var(--fg-muted); align-self: flex-end; margin-left: calc(-6px * var(--z)); }
.composer .att-btn:hover { color: var(--accent); }
.ch-att { display: flex; flex-wrap: wrap; gap: calc(6px * var(--z)); margin-bottom: calc(8px * var(--z)); }
.ch-chip { position: relative; display: flex; align-items: center; gap: calc(8px * var(--z)); padding: calc(5px * var(--z)) calc(4px * var(--z)) calc(5px * var(--z)) calc(8px * var(--z));
  border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); max-width: calc(280px * var(--z)); overflow: hidden; }
.ch-chip .nm { display: block; font-size: calc(13px * var(--z)); font-weight: 550; }
.ch-chip > .grow > .muted { display: block; font-size: calc(11.5px * var(--z)); }
.ch-chip.err { border-color: color-mix(in srgb, var(--danger) 55%, var(--border)); }
.ch-chip .bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); transition: width .2s; }
.ch-chip .fi { transform: scale(.85); }
.ch-files { display: grid; gap: calc(6px * var(--z)); margin-top: calc(4px * var(--z)); max-width: calc(520px * var(--z)); }
.ch-imgs { display: flex; flex-wrap: wrap; gap: calc(6px * var(--z)); }
.ch-imgs a { display: block; border-radius: var(--r); overflow: hidden; border: 1px solid var(--border-muted); background: var(--bg-inset); line-height: 0; }
.ch-imgs img { max-width: calc(260px * var(--z)); max-height: calc(200px * var(--z)); object-fit: cover; display: block; }
.ch-imgs a:only-child img { max-width: min(calc(420px * var(--z)), 100%); max-height: calc(320px * var(--z)); }
.ch-file { display: flex; align-items: center; gap: calc(10px * var(--z)); padding: calc(8px * var(--z)) calc(10px * var(--z)); border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); color: var(--fg); text-decoration: none; min-width: 0; }
a.ch-file:hover { border-color: var(--accent); background: var(--hover); text-decoration: none; }
a.ch-file > svg { color: var(--fg-muted); flex: none; }
.ch-file b { display: block; font-weight: 600; font-size: calc(13.5px * var(--z)); }
.ch-file .grow > .muted { display: block; }
.ch-file.drive { border-style: dashed; }
.ch-file .btn { flex: none; }
.suggest button.none { cursor: default; }
.suggest button .fi { transform: scale(.8); }
.mc-files { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; font-size: calc(12.5px * var(--z)); }
.mc-files a { display: inline-flex; align-items: center; gap: 4px; }
.fa-bar { height: calc(8px * var(--z)); border-radius: 99px; background: var(--border-muted); overflow: hidden; margin-top: calc(6px * var(--z)); }
.fa-bar.sm { height: calc(5px * var(--z)); margin-top: 0; }
.fa-bar > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.fa-bar.warn > i { background: var(--attention); }
.t tr.dim > td { opacity: .6; }
.suggest.wide { width: min(calc(560px * var(--z)), calc(100% - calc(40px * var(--z)))); }
/* ---------- 0.26: видео и картинки-памятки в базе знаний ---------- */
.md .md-video { display: block; margin: calc(10px * var(--z)) 0 calc(16px * var(--z)); }
.md .md-video video { display: block; width: 100%; max-width: calc(860px * var(--z)); border-radius: var(--r-lg); background: #000; border: 1px solid var(--border-muted); }
.md .md-video .cap { display: block; margin-top: 6px; color: var(--fg-muted); font-size: calc(13px * var(--z)); }
.md img { max-width: 100%; height: auto; border-radius: var(--r); border: 1px solid var(--border-muted); }
.kb-page .md img { cursor: zoom-in; }
.kb-zoom { position: fixed; inset: 0; z-index: 1000; background: rgba(1, 4, 9, .88); display: grid; place-items: center; align-content: center; gap: 10px; padding: 20px; cursor: zoom-out; }
.kb-zoom img { max-width: 96vw; max-height: 88vh; border-radius: var(--r); box-shadow: 0 10px 40px rgba(0, 0, 0, .6); }
.kb-zoom .cap { color: #c9d1d9; font-size: 14px; text-align: center; }

/* ---------- 0.29: доступ по локальной сети ---------- */
.net-state { display: flex; align-items: center; gap: calc(14px * var(--z)); padding: calc(14px * var(--z)) calc(16px * var(--z)); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.net-state > svg { color: var(--fg-muted); flex: none; }
.net-state.on { border-color: color-mix(in srgb, var(--success) 50%, var(--border)); background: var(--success-muted); }
.net-state.on > svg { color: var(--success); }
.net-urls { display: grid; gap: 6px; }
.net-url { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border-muted); border-radius: var(--r); flex-wrap: wrap; }
.net-url > svg { color: var(--fg-muted); flex: none; }
.net-url a { font-weight: 600; }
.net-res.ok-t { color: var(--success); }
.net-help ul { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.net-help .mono { padding: 1px 6px; border-radius: 6px; background: var(--surface-2, var(--hover)); }
.net-line { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.net-restart { position: fixed; inset: 0; z-index: 1000; background: var(--overlay); display: grid; place-items: center; }
.net-restart .box { min-width: 320px; max-width: 420px; }
.label.ok { color: var(--success); border-color: color-mix(in srgb, var(--success) 50%, transparent); }

/* ---------- 0.30: статус сервера, режим обслуживания ---------- */
.maint-ov { position: fixed; inset: 0; z-index: 2000; background: var(--bg); display: grid; place-items: center; padding: 20px; }
.maint-card { max-width: 460px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.maint-card h2 { margin: 6px 0 0; font-size: calc(24px * var(--z)); }
.maint-card p { margin: 0; }
.maint-logo { height: 34px; filter: var(--logo-filter); margin-bottom: 10px; }
.maint-ic { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--attention-muted); color: var(--attention); }
.maint-banner { position: sticky; top: 0; z-index: 900; background: var(--attention-muted); color: var(--fg); border-bottom: 1px solid var(--attention); padding: 6px 16px; font-size: calc(13px * var(--z)); display: flex; gap: 8px; align-items: center; justify-content: center; }
.srv-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.srv-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px var(--success-muted); }
.srv-dot.warn { background: var(--attention); box-shadow: 0 0 0 4px var(--attention-muted); }
.srv-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(calc(165px * var(--z)), 1fr)); gap: 12px; }
.srv-tile { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); padding: 14px 16px; display: grid; gap: 4px; align-content: start; }
.srv-tile .k { color: var(--fg-muted); font-size: calc(12.5px * var(--z)); display: flex; gap: 6px; align-items: center; }
.srv-tile .v { font-size: calc(24px * var(--z)); font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.srv-tile .sub { color: var(--fg-muted); font-size: calc(12.5px * var(--z)); }
.srv-spark { width: 100%; height: 90px; display: block; }
.srv-spark .ln { fill: none; stroke: var(--accent); stroke-width: 2; }
.srv-spark .ar { fill: var(--accent-muted); }
.srv-spark .gr { stroke: var(--border-muted); stroke-width: 1; }
.srv-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(calc(300px * var(--z)), 1fr)); gap: 12px; }
.srv-online { display: flex; flex-wrap: wrap; gap: 8px; }
.srv-online span.u { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border: 1px solid var(--border-muted); border-radius: 99px; font-size: calc(13px * var(--z)); }

/* ---------- Claude и тестовая версия (замечания и предложения) ---------- */
.icon.spin { animation: spin 1s linear infinite; }
.srv-dot.off { background: var(--fg-subtle, #888); box-shadow: 0 0 0 4px var(--surface-2); }
.ok-t { color: var(--success); }
.staging-bar { position: sticky; top: 0; z-index: 950; display: flex; align-items: center; gap: 10px; padding: 6px 16px; font-size: calc(13px * var(--z));
  color: var(--fg); border-bottom: 1px solid var(--done);
  background: repeating-linear-gradient(135deg, var(--done-muted) 0 14px, color-mix(in srgb, var(--done) 26%, var(--bg)) 14px 28px); }
.staging-bar .stg-tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; background: var(--done); color: #fff; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: calc(11.5px * var(--z)); flex: none; }
.staging-bar .stg-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.staging-bar .btn { flex: none; }
@media (max-width: 700px) { .staging-bar .stg-txt { display: none; } }
.fb-claude { margin-bottom: calc(14px * var(--z)); border-color: color-mix(in srgb, #d97757 40%, var(--border)); }
.fb-claude-head { display: flex; gap: 12px; align-items: flex-start; }
.fb-claude-head .muted { line-height: 1.5; margin-top: 2px; }
.fb-ctiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(calc(150px * var(--z)), 1fr)); gap: 8px; margin: calc(12px * var(--z)) 0; }
.fb-ctile { display: grid; gap: 2px; text-align: left; padding: calc(9px * var(--z)) calc(12px * var(--z)); border: 1px solid var(--border-muted); border-radius: var(--r); background: var(--surface-2); color: var(--fg-muted); font: inherit; cursor: pointer; }
.fb-ctile b { font-size: calc(20px * var(--z)); color: var(--fg-muted); font-weight: 650; }
.fb-ctile span { font-size: calc(12.5px * var(--z)); }
.fb-ctile.on { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); color: var(--fg); }
.fb-ctile.on b { color: var(--accent); }
.fb-ctile:hover { border-color: var(--accent); }
.fb-claude-foot { gap: 8px; flex-wrap: wrap; }
.fb-claude-foot svg { vertical-align: -2px; }
.fb-body .fb-md, .fb-md { white-space: normal; }
.fb-md p:last-child, .fb-md ul:last-child, .fb-md ol:last-child { margin-bottom: 0; }
.fb-links { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-link { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); font-size: calc(13px * var(--z)); text-decoration: none; }
.fb-link:hover { border-color: var(--accent); }
.fb-answer .box-foot { align-items: center; }
.fb-variants { display: grid; gap: 10px; }
.fb-var { display: grid; gap: 8px; padding: calc(12px * var(--z)) calc(14px * var(--z)); border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.fb-var.rec { border-color: color-mix(in srgb, var(--success) 50%, var(--border)); }
.fb-var.chosen { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.fb-var-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fb-var-key { display: inline-grid; place-items: center; width: calc(24px * var(--z)); height: calc(24px * var(--z)); border-radius: 6px; background: var(--done); color: #fff; font-weight: 700; font-size: calc(12px * var(--z)); flex: none; }
.fb-var .label svg { vertical-align: -1px; }
.fb-test { display: grid; gap: 8px; padding: calc(12px * var(--z)) calc(14px * var(--z)); border: 1px dashed var(--done); border-radius: var(--r); background: var(--done-muted); }
.fb-test-head { display: flex; align-items: flex-start; gap: 10px; }
.fb-test-head > svg { color: var(--done); margin-top: 2px; flex: none; }
.fb-test ol { margin: 4px 0 0; padding-left: 20px; }
.stg-item { display: flex; gap: 12px; align-items: flex-start; padding-bottom: 10px; border-bottom: 1px solid var(--border-muted); }
.stg-item:last-child { border-bottom: 0; padding-bottom: 0; }
.stg-item ol { margin: 6px 0 0; padding-left: 20px; }
.stg-log { max-height: 320px; overflow: auto; padding: 10px; background: var(--surface-2); border-radius: var(--r); font-size: calc(12px * var(--z)); white-space: pre-wrap; }
.stg-files { margin-top: 6px; max-height: 240px; overflow: auto; line-height: 1.6; }
.stg-off { margin: 0 0 8px; padding-left: 20px; line-height: 1.6; }

/* ---------- приветственное видео (web/js/welcome.js) ---------- */
.welcome-video { position: fixed; inset: 0; z-index: 10000; background: #000; }
.welcome-video iframe { display: block; width: 100%; height: 100%; border: 0; }
html.welcome-open, html.welcome-open body { overflow: hidden; }

/* ---------- заставка при запуске (web/js/intro.js) ---------- */
body.intro-on { overflow: hidden; }
.intro { position: fixed; inset: 0; z-index: 6000; background: #020203; color: #e8ebf2; opacity: var(--fade, 1); outline: none; font-family: "Mona Sans", "Inter", system-ui, sans-serif; user-select: none; -webkit-user-select: none; }
.intro.out { transition: opacity .38s ease; opacity: 0 !important; }
.intro-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.intro-top { position: absolute; z-index: 4; top: 18px; left: 22px; right: 22px; display: flex; align-items: center; gap: 10px; font-size: 13px; letter-spacing: .14em; color: #aab2c0; }
.intro-top img { width: 22px; height: 22px; filter: brightness(1.6); }
.intro-top b { color: #fff; font-weight: 700; }
.intro-top i { font-style: normal; margin-left: auto; font-family: "Mona Sans Mono", ui-monospace, monospace; letter-spacing: .05em; color: #6f7888; font-size: 12px; }
.intro-mute { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); color: #fff; border-radius: 99px; width: 32px; height: 32px; cursor: pointer; font-size: 14px; }
.intro-mute:hover { background: rgba(255,255,255,.14); }
.intro-steps { position: absolute; left: 22px; bottom: 22px; display: grid; gap: 4px; font-family: "Mona Sans Mono", ui-monospace, monospace; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: #8d96a6;
  padding: 12px 14px; border-radius: 10px; background: rgba(5,7,12,.55); border: 1px solid rgba(255,255,255,.07); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); min-width: 250px; }
.intro-steps .st { display: flex; gap: 8px; align-items: baseline; opacity: 0; transform: translateX(-8px); transition: opacity .25s, transform .25s; }
.intro-steps .st.on { opacity: 1; transform: none; }
.intro-steps .dots { flex: 1; border-bottom: 1px dotted rgba(255,255,255,.18); transform: translateY(-3px); }
.intro-steps .st.on:not(.done) .dots { animation: intro-dots 0.8s linear infinite; }
.intro-steps .ok { min-width: 30px; text-align: right; color: #39d98a; font-weight: 700; }
.intro-steps .st:last-child .ok { color: #ffc46b; }
.intro-steps .st.done .n { color: #d9dee8; }
@keyframes intro-dots { 50% { border-bottom-color: rgba(255,255,255,.45); } }
.intro-skip { position: absolute; right: max(16px, 2vw); bottom: max(16px, 2vw); padding: 12px 16px; border-radius: 10px; border: 2px solid rgba(255,255,255,.16); background: rgba(10,12,17,.6); color: #c9cfda; font: 700 15px/1 "Mona Sans", "Inter", system-ui, sans-serif; cursor: pointer; z-index: 4; }
.intro-skip:hover { color: #fff; border-color: rgba(255,255,255,.35); }
.intro-skip kbd { font-family: "Mona Sans Mono", ui-monospace, monospace; font-size: 10.5px; padding: 1px 5px; border-radius: 4px; border: 1px solid rgba(255,255,255,.2); color: #8d96a6; }
.intro-start { position: absolute; inset: 0; z-index: 3; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 20px; text-align: center; background: radial-gradient(circle at 50% 45%, rgba(255,196,107,.1), rgba(2,2,3,.6) 55%); }
.intro-start[hidden] { display: none; }
.intro-start .hey { font-size: clamp(30px, 5vw, 56px); font-weight: 800; letter-spacing: -.01em; color: #fff; text-shadow: 0 0 30px rgba(255,196,107,.35); animation: intro-hey 1.6s ease-in-out infinite; }
.intro-start .t { max-width: 520px; font-size: 15px; color: #aab2c0; line-height: 1.45; }
.intro-start [data-sound-on] { display: inline-flex; align-items: center; gap: 10px; margin-top: 6px; padding: 16px 30px; border-radius: 16px; border: 1px solid rgba(255,196,107,.6); background: radial-gradient(circle at 50% 0%, rgba(255,196,107,.28), rgba(10,12,18,.9) 70%);
  color: #fff; font: inherit; font-size: 18px; cursor: pointer; animation: intro-pulse 1.4s ease-out infinite; }
.intro-start [data-sound-on]:focus, .intro-start [data-sound-on]:focus-visible { outline: none; border-color: #ffc46b; }
.intro-start [data-sound-on] .ic { font-size: 24px; }
.intro-nosound { background: none; border: 0; color: #6f7888; font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.intro-nosound:hover { color: #aab2c0; }
@keyframes intro-hey { 0%, 100% { transform: rotate(-1.5deg); } 50% { transform: rotate(1.5deg) scale(1.03); } }
.intro.wait-power .ipulse { animation: intro-blink .9s ease-in-out infinite; }
@keyframes intro-blink { 50% { opacity: .25; } }
.intro-power .t { text-align: center; color: #c9cfda; font-size: 14px; margin-bottom: 10px; text-shadow: 0 1px 8px #000; }
.intro-power { position: absolute; left: 50%; bottom: 13%; transform: translateX(-50%); }
.intro-power[hidden] { display: none; }
.intro-power button { position: relative; display: grid; justify-items: center; gap: 2px; padding: 16px 30px 14px; border-radius: 18px; border: 1px solid rgba(255,196,107,.55); background: radial-gradient(circle at 50% 0%, rgba(255,196,107,.28), rgba(10,12,18,.85) 70%);
  color: #fff; font: inherit; cursor: pointer; box-shadow: 0 0 0 0 rgba(255,196,107,.5); animation: intro-pulse 1.4s ease-out infinite; }
.intro-power .ic { font-size: 26px; line-height: 1; filter: drop-shadow(0 0 10px rgba(255,196,107,.9)); }
.intro-power b { font-size: 17px; letter-spacing: .04em; }
.intro-power small { color: #b7bfcc; font-size: 12px; }
.intro-power button:hover { border-color: #ffc46b; }
.intro-power button:focus-visible, .intro-power button:focus { outline: none; border-color: #ffc46b; }
@keyframes intro-pulse { 0% { box-shadow: 0 0 0 0 rgba(255,196,107,.45); } 100% { box-shadow: 0 0 0 26px rgba(255,196,107,0); } }
@media (max-width: 700px) { .intro-steps { display: none; } .intro-top span { display: none; } }

/* ---------- ссылки-приглашения ---------- */
.inv-row { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border-muted); }
.inv-row:first-child { border-top: 0; padding-top: 0; }
.inv-row .muted.small { margin-top: 3px; line-height: 1.5; }
.inv-access { display: grid; gap: 5px; font-size: calc(13px * var(--z)); max-height: 260px; overflow: auto; padding: 10px 12px; border: 1px solid var(--border-muted); border-radius: var(--r); background: var(--surface-2); }
.inv-access > div { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.inv-access .lv { flex: none; min-width: calc(118px * var(--z)); font-size: calc(11.5px * var(--z)); padding: 1px 8px; border-radius: 99px; border: 1px solid var(--border); color: var(--fg-muted); text-align: center; }
.inv-access .lv2 { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.inv-access .lv3 { color: var(--success); border-color: color-mix(in srgb, var(--success) 50%, var(--border)); }
.auth-card.join { width: min(560px, 100%); max-width: 560px; }
.auth-card.join .grid-2 { gap: 10px; }
.join-info .small { margin-top: 3px; }

/* ===== Окно любой ширины (программа Blackout Portal и браузер) =====
   Страницы растягиваются на всю ширину окна, а пункты верхнего меню не прячутся за краем:
   на узком окне меню становится компактнее, затем остаются только значки (подпись — при наведении),
   и в крайнем случае появляется тонкая полоса прокрутки. */
main#view { max-width: calc(2400px * var(--z)); }
.app-nav { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.app-nav::-webkit-scrollbar { display: block; height: 4px; width: 4px; }
.app-nav::-webkit-scrollbar-button { display: none; }
:root:not([data-nav="left"]):not([data-nav="right"]) .app-nav { overflow-y: hidden; }
.app-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
@media (max-width: 1720px) {
  :root:not([data-nav="left"]):not([data-nav="right"]):not([data-nav="bottom"]) .app-nav { padding: 0 calc(10px * var(--z)); }
  :root:not([data-nav="left"]):not([data-nav="right"]):not([data-nav="bottom"]) .app-nav ul { gap: 0; }
  :root:not([data-nav="left"]):not([data-nav="right"]):not([data-nav="bottom"]) .app-nav a { padding: 0 calc(6px * var(--z)); gap: calc(5px * var(--z)); font-size: calc(13px * var(--z)); }
}
/* узкое окно: подписи разделов прячутся, только когда строка правда не помещается — .lbl-off (web/js/app.js → fitNav) */

/* ---------- Администрирование → Видео и анимация (web/js/media_admin.js) ---------- */
.md-flow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.md-step { display: grid; gap: 2px; padding: 9px 14px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface-2); font-weight: 600; font-size: calc(13.5px * var(--z)); }
.md-step svg { vertical-align: -2px; margin-right: 4px; }
.md-step small { font-weight: 400; color: var(--fg-muted); font-size: calc(11.5px * var(--z)); }
.md-step.on { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.md-step.off { opacity: .55; text-decoration: line-through; text-decoration-color: var(--fg-muted); }
.md-arr { display: grid; justify-items: center; color: var(--fg-muted); }
.md-arr small { font-size: calc(10.5px * var(--z)); }
.md-cap b { margin-right: 4px; }
.md-cap .btn { vertical-align: -3px; }
.md-cap .muted { margin-top: 3px; line-height: 1.45; }
.md-stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: calc(13px * var(--z)); color: var(--fg-muted); }
.md-stats b { color: var(--fg); font-size: calc(16px * var(--z)); margin-right: 2px; }
.md-key { display: inline-grid; place-items: center; min-width: 30px; height: 24px; padding: 0 6px; border-radius: 6px; background: var(--done-muted); color: var(--done); font: 700 calc(12px * var(--z)) var(--mono); }
.md-lessons td { vertical-align: top; }
.select.sm { height: calc(28px * var(--z)); font-size: calc(12.5px * var(--z)); padding-top: 0; padding-bottom: 0; }
.md-file { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border-muted); }
.md-file:first-child { border-top: 0; padding-top: 0; }
.md-ic { color: var(--fg-muted); }
.md-player { width: 100%; max-height: 70vh; border-radius: var(--r); background: #000; display: block; }
.md-users { display: grid; gap: 0; max-height: 55vh; overflow: auto; }
.md-user { display: flex; gap: 10px; align-items: center; padding: 8px 2px; border-top: 1px solid var(--border-muted); }
.md-user:first-child { border-top: 0; }
.md-upload { position: fixed; right: 20px; bottom: 20px; z-index: 900; width: min(380px, calc(100vw - 40px)); display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow, 0 8px 24px rgba(0,0,0,.35)); }
.md-upload .btn { justify-self: end; }

/* ---------- удаление пользователя ---------- */
.du-usage { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: calc(13px * var(--z)); }
.du-usage span { white-space: nowrap; }
.du-opts { display: grid; gap: 8px; }
.du-opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r); cursor: pointer; }
.du-opt:hover { border-color: var(--accent); }
.du-opt input { margin-top: 3px; }
.du-opt > span { display: grid; gap: 3px; }
.du-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-muted); }
.du-opt.danger:has(input:checked) { border-color: var(--danger); background: var(--danger-muted); }

/* ---------- Режим разработчика (web/js/dev.js, web/js/reqfields.js) ---------- */
/* меню инструментов: полоса во всю ширину внизу шапки (место под неё — --devband-h, страница сдвигается вниз),
   всегда поверх всех окон и диалогов; вынесенное за ⋮⋮ — плавающая «плашка»; свернуть и показать — пункт «Разработчик» */
.devbar { position: fixed; z-index: 1000; display: flex; align-items: center; gap: 2px; padding: 4px 6px; border-radius: 10px; border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(6px); box-shadow: 0 10px 30px rgba(0,0,0,.45);
  font-size: calc(12.5px * var(--z)); color: var(--fg); user-select: none; max-width: calc(100vw - 16px); flex-wrap: nowrap; overflow: hidden; }
.devbar[hidden] { display: none !important; }
.devbar.dragging { opacity: .88; box-shadow: 0 14px 40px rgba(0,0,0,.6); }
.devbar .dv-grip { cursor: grab; padding: 0 5px 0 2px; color: var(--fg-subtle); letter-spacing: -2px; font-weight: 700; align-self: stretch; display: inline-flex; align-items: center; }
.devbar.dragging .dv-grip { cursor: grabbing; }
.devbar .dv-title { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px 0 2px; margin-right: 4px; color: var(--accent); font-size: calc(11px * var(--z)); font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em; white-space: nowrap; border-right: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); align-self: stretch; }
.devbar .dv-tools { display: inline-flex; gap: 2px; }
.devbar .grow { flex: 1; }
.devbar button { display: inline-flex; align-items: center; gap: 6px; height: calc(28px * var(--z)); padding: 0 calc(10px * var(--z)); border: 0; border-radius: var(--r);
  background: none; color: var(--fg-muted); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.devbar button:hover { background: var(--hover); color: var(--fg); }
.devbar button.on { background: var(--accent); color: #fff; }
.devbar button .icon { color: var(--fg-subtle); }
.devbar button:hover .icon { color: var(--fg); }
.devbar button.on .icon { color: #fff; }
.devbar button.ic { padding: 0 calc(7px * var(--z)); }
.devbar .dv-create { color: var(--done, #a371f7); font-weight: 600; }
.devbar .dv-create .icon { color: var(--done, #a371f7); }
.devbar .dv-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--border); }
.devbar .dv-n { font-style: normal; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.devbar:not(.floating) .dv-dock { display: none; }
.devbar.floating .grow { display: none; }
.devbar.floating .dv-create { margin-left: 4px; }
.devbar.docked { left: 0; width: 100%; max-width: none; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; border-radius: 0; border: 0;
  border-top: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); padding: calc(5px * var(--z)) calc(16px * var(--z)); box-shadow: none; backdrop-filter: none;
  background: color-mix(in srgb, var(--accent) 7%, var(--header)); }
.devbar.docked::-webkit-scrollbar { display: none; }
.devbar.in-multi { flex-wrap: nowrap; padding: 2px 4px; box-shadow: none; }
.devbar.in-multi .dv-grip, .devbar.in-multi .dv-title > span, .devbar.in-multi .dv-tools button:not(.on) > span, .devbar.in-multi .dv-create > span, .devbar.in-multi [data-dv="hide"] { display: none; }
/* полоса не помещается (узкое окно или крупный масштаб) — сначала без заголовка, потом кнопки только значками (dev.js → fit) */
.devbar.tight .dv-title > span { display: none; }
.devbar.compact .dv-tools button:not(.on) > span, .devbar.compact .dv-create > span { display: none; }
.devbar.compact .dv-tools button { padding: 0 calc(8px * var(--z)); }
.app-header { padding-bottom: var(--devband-h, 0px); }
/* пункт «Разработчик» в строке разделов — после «Админ» */
.app-nav .nav-dev { position: relative; margin-left: calc(6px * var(--z)); padding-left: calc(6px * var(--z)); }
.app-nav .nav-dev::before { content: ""; position: absolute; left: 0; top: 30%; bottom: 30%; width: 1px; background: var(--border); }
.app-nav .nav-dev a, .app-nav .nav-dev a .icon { color: var(--accent); }
.app-nav .nav-dev a.dev-open { font-weight: 600; }
.app-nav .nav-dev a.dev-open::before { background: var(--accent-muted); }
.app-nav .nav-dev a > .icon:last-child { opacity: .75; transition: transform .15s; }
.app-nav .nav-dev a.dev-open > .icon:last-child { transform: rotate(180deg); }
.app-nav .nav-dev [data-dev-cnt] { background: var(--accent); color: #fff; }
.app-nav .nav-dev a.dev-open [data-dev-cnt] { display: none; }
:root[data-nav="left"] .app-nav .nav-dev, :root[data-nav="right"] .app-nav .nav-dev { margin: calc(6px * var(--z)) 0 0; padding: calc(6px * var(--z)) 0 0; }
:root[data-nav="left"] .app-nav .nav-dev::before, :root[data-nav="right"] .app-nav .nav-dev::before { left: 8px; right: 8px; top: 0; bottom: auto; width: auto; height: 1px; }
:root[data-nav="bottom"] .app-nav .nav-dev a > .icon:last-child { display: none; }
.menu.dv-menu { z-index: 1001; position: fixed; }
.menu.dv-menu .dv-mi { display: flex; align-items: flex-start; gap: 10px; text-align: left; white-space: normal; }
.menu.dv-menu .dv-mi .grow { display: grid; gap: 1px; }
.menu.dv-menu .dv-mi .icon { margin-top: 2px; flex: none; }
.menu.dv-menu .dv-mi.on b { color: var(--accent); }
/* строка разделов не помещается — у части разделов только значки (web/js/app.js → fitNav) */
:root:not([data-nav="left"]):not([data-nav="right"]):not([data-nav="bottom"]) .app-nav a.lbl-off > span.lbl { display: none; }
:root:not([data-nav="left"]):not([data-nav="right"]):not([data-nav="bottom"]) .app-nav a.lbl-off { padding: 0 calc(9px * var(--z)); }
html.dv-inspect, html.dv-inspect * { cursor: crosshair !important; }
html.dv-inspect .devbar, html.dv-inspect .devbar *, html.dv-inspect .dv-card, html.dv-inspect .dv-card * { cursor: default !important; }
.dv-hl { position: fixed; z-index: 1003; pointer-events: none; border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); border-radius: 4px; transition: all .06s; }
.dv-hl-tag { position: absolute; left: -2px; bottom: 100%; margin-bottom: 3px; max-width: 520px; padding: 2px 8px; border-radius: 4px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-hl-tag.below { bottom: auto; top: 100%; margin: 3px 0 0; }
.dv-card, .dv-pop { position: fixed; z-index: 1002; width: min(460px, calc(100vw - 16px)); max-height: calc(100vh - 80px); overflow: auto; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--accent); background: var(--surface); box-shadow: 0 16px 44px rgba(0,0,0,.55); font-size: 12.5px; color: var(--fg); }
.dv-pop.info { right: 12px; top: 64px; width: min(560px, calc(100vw - 24px)); display: flex; flex-direction: column; }
.dv-pop.req-hint { left: 12px; bottom: 12px; width: min(420px, calc(100vw - 24px)); }
.dv-card-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.dv-card-h > b { flex: 1; min-width: 0; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.dv-card .dv-x, .dv-pop .dv-x { border: 0; background: none; color: var(--fg-muted); cursor: pointer; padding: 2px; border-radius: 4px; display: inline-grid; }
.dv-card .dv-x:hover, .dv-pop .dv-x:hover { background: var(--hover); color: var(--fg); }
.dv-path { margin-bottom: 8px; padding: 6px 8px; border-radius: 6px; background: var(--accent-muted); color: var(--fg); line-height: 1.4; }
.dv-card table, .dv-pop table { width: 100%; border-collapse: collapse; }
.dv-card th, .dv-pop th { text-align: left; font-weight: 500; color: var(--fg-muted); padding: 3px 10px 3px 0; vertical-align: top; white-space: nowrap; width: 1%; }
.dv-card td, .dv-pop td { padding: 3px 0; vertical-align: top; word-break: break-word; }
.dv-card .mono, .dv-pop .mono { font-family: var(--mono); font-size: 11.5px; }
.dv-sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; border: 1px solid var(--border); vertical-align: -1px; margin-right: 4px; }
.dv-card-f { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.dv-tabs { display: flex; gap: 2px; margin-left: 6px; }
.dv-tabs button { border: 0; background: none; color: var(--fg-muted); font: inherit; font-size: 12px; padding: 3px 8px; border-radius: 999px; cursor: pointer; }
.dv-tabs button.on { background: var(--accent); color: #fff; }
.dv-pop-b { overflow: auto; min-height: 0; }
.dv-sub { margin: 10px 0 4px; font-weight: 650; color: var(--fg-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.dv-log td { border-bottom: 1px solid var(--border-muted); padding: 3px 6px 3px 0; white-space: nowrap; }
.dv-log .dv-path-c { white-space: normal; word-break: break-all; }
.dv-log tr.bad td { color: var(--danger); }
.dv-log tr.slow td { color: var(--attention); }
.dv-req-chip { margin-left: 6px; min-width: 20px; height: 18px; padding: 0 5px; border-radius: 9px; border: 1px dashed var(--accent); background: var(--surface); color: var(--accent);
  font-size: 12px; font-weight: 700; line-height: 1; cursor: pointer !important; vertical-align: 1px; text-transform: none; letter-spacing: 0; }
.dv-req-chip.on { border-style: solid; background: var(--accent); color: #fff; }
.dv-req-chip.lock { border-color: var(--border); color: var(--fg-muted); cursor: help !important; }
.dv-req-list { margin-top: 8px; }
th.dev-req::after { content: " *"; color: var(--danger); }
.dev-missing { outline: 2px solid var(--danger) !important; outline-offset: 2px; border-radius: 4px; }
td.dev-missing { outline-offset: -2px; }
html.dv-grid .lay-zone[data-zone="main"] { --g: calc(16px * var(--z));
  background-image: repeating-linear-gradient(90deg, color-mix(in srgb, var(--accent) 9%, transparent) 0 calc((100% - 11 * var(--g)) / 12), transparent calc((100% - 11 * var(--g)) / 12) calc((100% - 11 * var(--g)) / 12 + var(--g))); }
html.dv-names [data-win] { outline: 1px dashed color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }
html.dv-names .lay-zone > [data-win]::after { content: attr(data-win-title) " · " attr(data-win); position: absolute; top: -9px; right: 10px; z-index: 5; padding: 0 6px; border-radius: 4px;
  background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 600; line-height: 16px; pointer-events: none; }
html.dv-names .field[data-dv-name] { position: relative; }
html.dv-names .field[data-dv-name]::after { content: attr(data-dv-name); position: absolute; top: 0; right: 0; padding: 0 5px; border-radius: 3px; background: var(--accent-muted);
  color: var(--accent); font: 600 10.5px/15px var(--mono); pointer-events: none; }
.dv-users { display: grid; gap: 2px; max-height: 46vh; overflow: auto; padding: 4px; border: 1px solid var(--border-muted); border-radius: var(--r); }
.dv-users .dv-u { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; }
.dv-users .dv-u:hover { background: var(--hover); }
.dv-users .dv-u .grow { display: grid; }
.dv-users .dv-u.off { opacity: .55; }
.dv-users .dv-u[hidden] { display: none; }
#dv-multi { position: fixed; inset: 0; z-index: 98; display: flex; flex-direction: column; background: var(--bg); }
.dvm-top { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface); font-size: 13px; flex-wrap: wrap; }
.dvm-top .dvm-route { width: 260px; max-width: 30vw; }
.dvm-top .dvm-title { display: inline-flex; align-items: center; gap: 6px; }
.dvm-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 6px; padding: 6px; }
.dvm-pane { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.dvm-h { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 8px; border-bottom: 1px solid var(--border-muted); font-size: 12.5px; min-width: 0; }
.dvm-h .avatar.sm { width: 22px; height: 22px; font-size: 10px; flex: none; }
.dvm-pane iframe { flex: 1; width: 100%; border: 0; background: var(--bg); }
.as-banner { position: fixed; left: 10px; bottom: 10px; z-index: 90; display: flex; align-items: center; gap: 6px; max-width: calc(100% - 20px); padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--done, #a371f7); background: var(--surface); box-shadow: 0 6px 20px rgba(0,0,0,.4); font-size: 12px; color: var(--fg); }
.as-banner .small { color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.as-banner b, .as-banner .muted { white-space: nowrap; flex: none; }

/* ---------- Встроенный вид (?embed=1 — заявка внутри очереди согласования) ---------- */
html.embed .app-header, html.embed .as-banner, html.embed .devbar, html.embed .crumbs, html.embed .staging-bar { display: none !important; }
html.embed main#view { padding-top: calc(12px * var(--z)); max-width: none; }

/* ---------- Мои задачи (web/js/pages/tasks.js) ---------- */
.tk-sum { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: calc(14px * var(--z)); }
.tk-chip { display: inline-flex; align-items: center; gap: 6px; height: calc(32px * var(--z)); padding: 0 calc(12px * var(--z)); border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--fg-muted); font: inherit; font-size: calc(13px * var(--z)); cursor: pointer; }
.tk-chip b { color: var(--fg); }
.tk-chip.on { border-color: var(--accent); background: var(--accent-muted); color: var(--fg); }
.tk-red { color: var(--danger); font-weight: 600; font-size: calc(12px * var(--z)); }
.tk-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(520px * var(--z)), 1fr)); gap: calc(16px * var(--z)); align-items: start; }
.tk-group .box-head h2 { flex: none; }
.tk-row { display: flex; align-items: center; gap: 10px; padding: calc(9px * var(--z)) calc(14px * var(--z)); border-top: 1px solid var(--border-muted); color: var(--fg); }
.tk-row:hover { background: var(--hover); text-decoration: none; }
.tk-row .grow { display: grid; min-width: 0; }
.tk-row .tk-t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-row .grow .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-row > .icon { color: var(--fg-subtle); flex: none; }
.tk-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); flex: none; }
.tk-row.soon .tk-dot { background: var(--attention); }
.tk-row.overdue .tk-dot { background: var(--danger); }
.tk-due { display: inline-flex; align-items: center; gap: 4px; font-size: calc(12px * var(--z)); color: var(--fg-muted); white-space: nowrap; }
.tk-due.soon { color: var(--attention); }
.tk-due.overdue { color: var(--danger); font-weight: 600; }

/* ---------- Очередь согласования (web/js/pages/approvals.js) ---------- */
.aq { display: grid; grid-template-columns: calc(360px * var(--z)) minmax(0, 1fr); gap: calc(16px * var(--z)); align-items: start; }
.aq-list { position: sticky; top: calc(var(--shell-top, 96px) + 12px); max-height: calc(100vh - var(--shell-top, 96px) - 28px); display: flex; flex-direction: column; overflow: hidden; }
.aq-tools { display: grid; gap: 8px; padding: 10px; border-bottom: 1px solid var(--border-muted); }
.aq-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.aq-tabs button { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); background: none; color: var(--fg-muted); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: calc(12.5px * var(--z)); cursor: pointer; }
.aq-tabs button.on { border-color: var(--accent); background: var(--accent-muted); color: var(--fg); }
#aq-items { overflow: auto; }
.aq-item { display: grid; gap: 3px; width: 100%; text-align: left; padding: calc(10px * var(--z)) 12px; border: 0; border-bottom: 1px solid var(--border-muted); border-left: 3px solid transparent; background: none; color: var(--fg); font: inherit; cursor: pointer; }
.aq-item:hover { background: var(--hover); }
.aq-item.on { background: var(--accent-muted); border-left-color: var(--accent); }
.aq-item.urgent:not(.on) { border-left-color: var(--danger); }
.aq-top, .aq-sub { display: flex; align-items: center; gap: 6px; min-width: 0; }
.aq-top .label { height: 18px; font-size: 11px; }
.aq-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aq-sub .ellipsis { flex: 1; min-width: 0; }
.aq-empty { display: grid; justify-items: center; gap: 6px; padding: 40px 16px; text-align: center; color: var(--fg-muted); }
.aq-empty .icon { color: var(--success); }
.aq-detail { display: grid; gap: calc(12px * var(--z)); min-width: 0; }
.aq-head { padding: calc(12px * var(--z)) calc(14px * var(--z)); display: grid; gap: 6px; }
.aq-h1 { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: calc(15px * var(--z)); }
.aq-h1 .num { font-size: calc(16px * var(--z)); font-weight: 650; }
.aq-act { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; margin-top: 4px; }
.aq-act textarea { flex: 1 1 260px; min-height: calc(36px * var(--z)); resize: vertical; }
.aq-act kbd { margin-left: 4px; opacity: .75; }
.aq-frame-box { overflow: hidden; padding: 0; }
.aq-frame { display: block; width: 100%; height: calc(100vh - var(--shell-top, 96px) - 200px); min-height: 480px; border: 0; background: var(--bg); }
@media (max-width: 1000px) { .aq { grid-template-columns: 1fr; } .aq-list { position: static; max-height: 46vh; } }
kbd { display: inline-block; min-width: 18px; padding: 0 5px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2);
  font: 600 calc(11px * var(--z))/1.6 var(--mono); color: var(--fg-muted); text-align: center; vertical-align: 1px; }

/* ---------- Календарь проектов (web/js/pages/calendar.js) ---------- */
.cal-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.cal-tools .input-icon { width: calc(220px * var(--z)); }
.cal-tools .select { width: auto; min-width: calc(150px * var(--z)); }
.cal-period { font-size: calc(15px * var(--z)); margin-left: 4px; }
.seg button { border: 0; background: var(--surface); color: var(--fg-muted); padding: calc(4px * var(--z)) calc(12px * var(--z)); min-height: calc(32px * var(--z)); line-height: 1.25; font: inherit; cursor: pointer; border-left: 1px solid var(--border); }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--accent-muted); color: var(--fg); font-weight: 600; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin-bottom: 10px; }
.cal-lg { display: inline-flex; align-items: center; gap: 5px; }
.cal-lg i { width: 18px; height: 9px; border-radius: 3px; display: inline-block; background: var(--c, var(--border)); }
.cal-lg.mount i, .cal-ext { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--fg-muted) 35%, transparent) 0 3px, transparent 3px 6px); }
.st-draft { --c: #7d8590; } .st-submitted { --c: #d29922; } .st-returned { --c: #f85149; } .st-approved { --c: #3fb950; } .st-closed { --c: #4493f8; } .st-none { --c: #6e7681; }
.cal-box { padding: 0; overflow: hidden; }
.cal-scroll { overflow: auto; max-height: calc(100vh - var(--shell-top, 96px) - 200px); }
.cal-grid { --lbl: calc(260px * var(--z)); min-width: calc(var(--lbl) + var(--W)); position: relative; }
.cal-head { display: flex; position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--border); }
.cal-lbl { width: var(--lbl); flex: none; display: grid; align-content: center; padding: 0 12px; min-width: 0; position: sticky; left: 0; z-index: 2; background: var(--surface); border-right: 1px solid var(--border-muted); }
.cal-corner { color: var(--fg-muted); font-size: calc(12px * var(--z)); z-index: 4; }
.cal-hd { display: grid; }
.cal-months, .cal-days { display: flex; }
.cal-m { padding: 4px 6px; font-weight: 650; font-size: calc(12px * var(--z)); text-transform: capitalize; border-left: 1px solid var(--border-muted); white-space: nowrap; overflow: hidden; }
.cal-d { flex: none; display: grid; justify-items: center; align-content: center; height: calc(30px * var(--z)); font-size: calc(11.5px * var(--z)); color: var(--fg-muted); font-variant-numeric: tabular-nums; }
.cal-d small { font-size: calc(9.5px * var(--z)); opacity: .8; }
.cal-d.wk { color: var(--fg-subtle); background: color-mix(in srgb, var(--fg) 3%, transparent); }
.cal-d.today { color: #fff; background: var(--accent); border-radius: 4px; font-weight: 700; }
.cal-body { position: relative; }
.cal-bg { position: absolute; top: 0; bottom: 0; left: var(--lbl); pointer-events: none; }
.cal-bg i { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--fg) 3%, transparent); }
.cal-now { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--danger); opacity: .8; z-index: 1; }
.cal-group { display: flex; min-height: calc(30px * var(--z)); border-top: 1px solid var(--border); background: var(--surface-2); position: relative; }
.cal-group .cal-lbl { background: var(--surface-2); display: flex; align-items: center; gap: 6px; }
.cal-load { display: flex; position: relative; z-index: 1; }
.cal-load i { flex: none; display: grid; place-items: center; font-style: normal; font-size: calc(10.5px * var(--z)); font-weight: 600; color: var(--fg);
  background: color-mix(in srgb, var(--accent) calc(var(--a) * 100%), transparent); }
.cal-row { display: flex; min-height: calc(34px * var(--z)); border-top: 1px solid var(--border-muted); color: var(--fg); position: relative; }
.cal-row:hover { background: var(--hover); text-decoration: none; }
.cal-row:hover .cal-lbl { background: var(--hover); }
.cal-row .cal-lbl b { font-size: calc(12.5px * var(--z)); font-weight: 600; }
.cal-row .cal-lbl .small { font-size: calc(11px * var(--z)); }
.cal-track { position: relative; flex: none; z-index: 1; }
.cal-bar, .cal-ext { position: absolute; top: 50%; height: calc(18px * var(--z)); margin-top: calc(-9px * var(--z)); border-radius: 5px; }
.cal-bar { background: var(--c, var(--accent)); box-shadow: 0 1px 2px rgba(0,0,0,.3); overflow: hidden; }
.cal-bar span { display: block; padding: 0 6px; color: #fff; font-size: calc(11px * var(--z)); font-weight: 600; line-height: calc(18px * var(--z)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 1px rgba(0,0,0,.35); }
.cal-ext { border-radius: 3px; }
:root[data-theme="light"] .cal-bar span { color: #fff; }

/* ---------- План-факт (web/js/pages/finance.js) ---------- */
.pf-stats .stat .v { font-size: calc(22px * var(--z)); }
.pos { color: var(--success); } .neg { color: var(--danger); }
.pf-pivot td, .pf-pivot th { padding-top: 6px; padding-bottom: 6px; }
.pf-bar { position: relative; height: 4px; margin-top: 4px; width: calc(120px * var(--z)); border-radius: 2px; background: var(--border-muted); }
.pf-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: var(--success); }
.pf-bar i.c { background: var(--danger); opacity: .7; height: 2px; top: 1px; }
.pf-card { display: grid; grid-template-columns: repeat(auto-fit, minmax(calc(220px * var(--z)), 1fr)); gap: calc(20px * var(--z)); }
.pf-col { display: grid; gap: 6px; align-content: start; }
.pf-h { font-weight: 650; color: var(--fg-muted); text-transform: uppercase; letter-spacing: .05em; font-size: calc(11.5px * var(--z)); }
.pf-kv { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; align-items: baseline; }
.pf-kv .k { color: var(--fg-muted); font-size: calc(12.5px * var(--z)); }
.pf-kv .v { font-weight: 650; font-variant-numeric: tabular-nums; }
.pf-kv .small { grid-column: 1 / -1; }
.pf-line { display: block; height: 5px; border-radius: 3px; background: var(--border-muted); overflow: hidden; }
.pf-line i { display: block; height: 100%; background: var(--accent); }
.pf-line.paid i { background: var(--success); } .pf-line.cost i { background: var(--danger); opacity: .75; }
.pf-note { margin-top: 4px; }

/* ---------- Быстрые команды Cmd+K (web/js/hotkeys.js) ---------- */
.cmdk { position: fixed; inset: 0; z-index: 150; display: grid; place-items: start center; padding-top: 12vh; background: rgba(0,0,0,.45); animation: fadeIn .12s; }
.cmdk-box { width: min(640px, calc(100vw - 24px)); border-radius: 12px; border: 1px solid var(--border); background: var(--surface); box-shadow: 0 24px 80px rgba(0,0,0,.55); overflow: hidden; }
.cmdk-in { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border-muted); color: var(--fg-muted); }
.cmdk-in input { flex: 1; border: 0; outline: 0; background: none; color: var(--fg); font: inherit; font-size: calc(16px * var(--z)); }
.cmdk-list { max-height: min(56vh, 460px); overflow: auto; padding: 6px; }
.cmdk-sec { padding: 8px 10px 4px; font-size: calc(11px * var(--z)); font-weight: 650; color: var(--fg-subtle); text-transform: uppercase; letter-spacing: .05em; }
.cmdk-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.cmdk-item .icon { color: var(--fg-subtle); flex: none; }
.cmdk-item.on { background: var(--accent-muted); }
.cmdk-item.on .icon { color: var(--accent); }
.cmdk-empty { padding: 18px 12px; text-align: center; }
.cmdk-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--border-muted); color: var(--fg-subtle); font-size: calc(12px * var(--z)); }
.hk { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.hk td { padding: 5px 8px 5px 0; border-bottom: 1px solid var(--border-muted); font-size: calc(13px * var(--z)); }
.hk-grid h3 { margin: 4px 0 8px; }

/* ---------- горячие клавиши: выбранная строка списка, подсказка, Администрирование → Горячие клавиши (web/js/hotkeys.js) ---------- */
.t tbody tr.kb-sel { background: var(--accent-muted); box-shadow: inset 3px 0 0 var(--accent); }
.t tbody tr.kb-sel:hover { background: var(--accent-muted); }
.hk td kbd + kbd, .hk-chip kbd + kbd { margin-left: 2px; }
.hk-then { margin: 0 5px; color: var(--fg-subtle); font-size: .85em; }
.hk-or { margin: 0 7px; color: var(--fg-subtle); font-size: .85em; }
.hk-head { margin-bottom: calc(12px * var(--z)); }
.hk-tools { margin: calc(12px * var(--z)) 0; }
.hk-grp { margin-bottom: calc(14px * var(--z)); }
.hk-t { table-layout: fixed; }
.hk-t td { vertical-align: middle; }
.hk-t th:nth-child(1) { width: 44%; } .hk-t th:nth-child(2) { width: 32%; } .hk-t th:nth-child(4) { width: 52px; }
.hk-t tr.hk-ch td:first-child b::after { content: " · изменено"; color: var(--accent); font-weight: 500; font-size: .85em; }
.hk-chip { display: inline-flex; align-items: center; gap: 2px; margin: 2px 6px 2px 0; padding: 2px 2px 2px 6px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.hk-chip button { display: inline-grid; padding: 2px; border: 0; border-radius: 4px; background: none; color: var(--fg-subtle); cursor: pointer; }
.hk-chip button:hover { color: var(--danger); background: var(--hover); }
.hk-chip.bad { border-color: var(--danger); background: var(--danger-muted); }
.hk-capture { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border: 1px dashed var(--accent); border-radius: var(--r); color: var(--accent); font-size: calc(12.5px * var(--z)); }
.hk-msg { margin-top: 2px; color: var(--danger); font-size: calc(12px * var(--z)); display: flex; gap: 4px; align-items: center; }
.danger-text { color: var(--danger); }
.attention-text { color: var(--attention); }
/* подсказки клавиш выключены (Профиль → Интерфейс) или выключены сами горячие клавиши */
html.hk-hints-off .hk-hint, html.hk-hints-off .gsearch > kbd { display: none !important; }
.check.top { align-items: flex-start; }
.check.top input { margin-top: calc(3px * var(--z)); flex: none; }
/* под-чат в заявках: заголовок сворачивает окно (0.45.1) */
.mchat .mc-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0; margin: 0; color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.mchat .mc-title h3 { flex: 0 1 auto; display: block; margin: 0; }
.mchat .mc-title .chev { display: inline-grid; color: var(--fg-muted); transition: transform .18s var(--ease); }
.mchat .mc-head:hover { background: var(--hover); }
.mchat.win-folded .mc-title .chev, .mchat.mc-closed .mc-title .chev { transform: rotate(-90deg); }
.mchat:not(.win-folded):not(.mc-closed) [data-mc-count] { display: none; }
.mchat.mc-closed > :not(.box-head) { display: none; }
.mchat.win-folded > .box-head, .mchat.mc-closed > .box-head { border-bottom-color: transparent; }
/* 0.46: меню «Скачать» в заявках (web/js/download-menu.js) */
.dl-menu button { align-items: flex-start; }
.dl-menu button .icon { margin-top: 2px; color: var(--fg-muted); flex: none; }
.dl-menu .dl-t { display: grid; line-height: 1.25; min-width: 0; }
.dl-menu .dl-t small { color: var(--fg-muted); font-size: calc(11.5px * var(--z)); }
/* 0.46: кнопки-переключатели в две строки (например, «Насколько важно» в замечаниях) — высота по тексту, текст не обрезается */
.seg.fb-imp button { padding: calc(6px * var(--z)) calc(8px * var(--z)); line-height: 1.25; height: auto; white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 640px) { .seg.fb-imp button { font-size: calc(12.5px * var(--z)); padding: calc(6px * var(--z)) calc(5px * var(--z)); } }

/* 0.50 · Заявка на доход: поля «Информации о проекте» и «Доходной информации» — по содержимому, а не на весь экран */
.lay[data-lay="income"] [data-sec="project"] .grid-2 { grid-template-columns: minmax(0, 380px) minmax(0, 560px); }
.lay[data-lay="income"] [data-sec="project"] #provides { max-width: calc(560px * var(--z)); }
.lay[data-lay="income"] [data-sec="project"] .stage-table { width: auto; }
.lay[data-lay="income"] [data-sec="project"] .stage-table .input[type=date] { width: calc(150px * var(--z)); }
.lay[data-lay="income"] [data-sec="project"] .stage-table .input[type=time] { width: calc(104px * var(--z)); min-width: 0; }
.lay[data-lay="income"] [data-sec="finance"] table.fin, .lay[data-lay="income"] [data-sec="finance"] table.cp-table { width: auto; max-width: 100%; }
.lay[data-lay="income"] [data-sec="finance"] .fin [data-f=net], .lay[data-lay="income"] [data-sec="finance"] .fin [data-f=gross],
.lay[data-lay="income"] [data-sec="finance"] .cp-table [data-cpf=net], .lay[data-lay="income"] [data-sec="finance"] .cp-table [data-cpf=gross] { width: calc(150px * var(--z)); min-width: 0; }
.lay[data-lay="income"] [data-sec="finance"] .fin [data-f=tax], .lay[data-lay="income"] [data-sec="finance"] .cp-table [data-cpf=tax] { width: calc(190px * var(--z)); min-width: 0; }
.lay[data-lay="income"] [data-sec="finance"] .fin [data-f=comment], .lay[data-lay="income"] [data-sec="finance"] .cp-table [name=contract_comment] { width: calc(260px * var(--z)); }
.lay[data-lay="income"] [data-sec="finance"] .fin [data-f=req_type] { width: calc(170px * var(--z)); }
.lay[data-lay="income"] [data-sec="finance"] .cp-box { max-width: max-content; }
.lay[data-lay="income"] [data-sec="finance"] .cp-box #cp-hint { display: block; max-width: calc(760px * var(--z)); }
@media (max-width: 900px) { .lay[data-lay="income"] [data-sec="project"] .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.proj-flags { gap: 8px 20px; }
.ipf .box-head { gap: 8px; }
.ipf .box-head h3 { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ipf .pf-seg button { padding: 2px 10px; font-size: calc(12px * var(--z)); min-height: 0; }
.ipf .pf-file { padding-left: 0; }
.ipf .pf-file .btn.icon-only { flex: none; }
.ipf .ipf-dir + .ipf-dir { margin-top: 10px; }

/* 0.50 · Заявки на доход: вкладки статусов и строка поиска с фильтрами — в одну строку; фильтры как в Битрикс24 */
.list-box .list-bar.bx-bar { flex-wrap: nowrap; }
.list-box .list-bar.bx-bar .tabs { flex: 0 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.list-box .list-bar.bx-bar .list-tools { flex: 1 1 420px; flex-wrap: nowrap; min-width: calc(320px * var(--z)); justify-content: flex-end; }
@media (max-width: 1000px) { .list-box .list-bar.bx-bar { flex-wrap: wrap; } .list-box .list-bar.bx-bar .list-tools { flex-basis: 100%; } }
.bx-box { flex: 1 1 auto; max-width: calc(640px * var(--z)); min-height: calc(32px * var(--z)); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 2px 4px 2px 8px;
  border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); cursor: text; }
.bx-box:hover { border-color: var(--fg-subtle, var(--border)); }
.bx-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-muted); }
.bx-box > .icon { color: var(--fg-muted); flex: none; }
.bx-q { flex: 1 1 120px; min-width: 100px; border: 0; outline: 0; background: none; color: var(--fg); font: inherit; font-size: calc(13px * var(--z)); padding: 4px 2px; }
.bx-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 2px 1px 8px; border-radius: 999px; background: var(--accent-muted); border: 1px solid var(--accent); font-size: calc(12px * var(--z)); max-width: 100%; white-space: nowrap; }
.bx-chip b { font-weight: 600; }
.bx-chip button, .bx-tag button { display: inline-grid; place-items: center; width: 16px; height: 16px; border: 0; border-radius: 50%; background: none; color: var(--fg-muted); cursor: pointer; padding: 0; }
.bx-chip button:hover, .bx-tag button:hover { background: var(--hover); color: var(--fg); }
.bx-clear, .bx-more { flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: var(--r); background: none; color: var(--fg-muted); cursor: pointer; }
.bx-clear:hover, .bx-more:hover { background: var(--hover); color: var(--fg); }
.bx-pop { position: absolute; z-index: 80; display: grid; grid-template-columns: calc(190px * var(--z)) minmax(0, 1fr); border: 1px solid var(--border); border-radius: calc(var(--r) * 1.5);
  background: var(--surface); box-shadow: 0 12px 32px rgba(0,0,0,.18); overflow: visible; }
.bx-side { padding: 10px 8px; border-right: 1px solid var(--border-muted); background: var(--surface-2); display: flex; flex-direction: column; gap: 2px; border-radius: calc(var(--r) * 1.5) 0 0 calc(var(--r) * 1.5); }
.bx-side-t { font-size: calc(11px * var(--z)); text-transform: uppercase; letter-spacing: .04em; color: var(--fg-muted); font-weight: 600; padding: 2px 8px 4px; }
.bx-pre { display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--fg); padding: 5px 8px; border-radius: var(--r); cursor: pointer; font: inherit; font-size: calc(13px * var(--z)); }
.bx-pre:hover { background: var(--hover); }
.bx-pre.add { color: var(--accent); margin-top: 8px; display: inline-flex; align-items: center; gap: 4px; }
.bx-pre-row { display: flex; align-items: center; }
.bx-pre-row .bx-pre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bx-pre-del { flex: none; border: 0; background: none; color: var(--fg-muted); cursor: pointer; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.bx-pre-del:hover { background: var(--hover); color: var(--danger); }
.bx-main { padding: 12px 14px; display: grid; gap: 12px; min-width: 0; }
.bx-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.bx-f { display: grid; gap: 4px; min-width: 0; }
.bx-f > label { font-size: calc(12px * var(--z)); color: var(--fg-muted); font-weight: 600; }
.bx-ms { position: relative; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: calc(32px * var(--z)); padding: 3px 6px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); cursor: text; }
.bx-ms:focus-within { border-color: var(--accent); }
.bx-ms-q { flex: 1 1 60px; min-width: 60px; border: 0; outline: 0; background: none; color: var(--fg); font: inherit; font-size: calc(13px * var(--z)); padding: 2px; }
.bx-tag { display: inline-flex; align-items: center; gap: 3px; padding: 1px 2px 1px 7px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); font-size: calc(12px * var(--z)); max-width: 100%; }
.bx-sug { position: absolute; z-index: 5; left: -1px; right: -1px; top: calc(100% + 2px); max-height: 240px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: 0 8px 20px rgba(0,0,0,.15); padding: 4px; }
.bx-sug button { display: flex; width: 100%; gap: 8px; align-items: center; text-align: left; border: 0; background: none; color: var(--fg); padding: 5px 8px; border-radius: var(--r); cursor: pointer; font: inherit; font-size: calc(13px * var(--z)); }
.bx-sug button:hover { background: var(--hover); }
.bx-range { display: flex; align-items: center; gap: 6px; }
.bx-range .input { flex: 1; min-width: 0; }
.bx-flags { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.bx-foot { display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border-muted); }
@media (max-width: 640px) { .bx-pop { grid-template-columns: minmax(0, 1fr); } .bx-side { border-right: 0; border-bottom: 1px solid var(--border-muted); } .bx-grid { grid-template-columns: minmax(0, 1fr); } }
/* 0.50.1 · «Заявки на доход»: описание — по значку «i», строка поиска с фильтрами — под заголовком */
.page-head.bx-head { align-items: flex-end; }
.bx-head-l { flex: 1 1 auto; min-width: 0; display: grid; gap: calc(10px * var(--z)); }
.bx-head-l h1 { display: flex; align-items: center; gap: 8px; }
.bx-head-l #lt { display: flex; align-items: center; gap: 8px; }
.bx-head-l .bx-box { width: 100%; max-width: calc(640px * var(--z)); }
.info-i { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--fg-muted); cursor: pointer; padding: 0; flex: none; }
.info-i:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-muted); }
.page-info-pop { display: flex; gap: 10px; padding: 10px 12px; line-height: 1.45; font-size: calc(13px * var(--z)); }
.page-info-pop > .icon { color: var(--accent); flex: none; margin-top: 2px; }
.dk-t .fml-ex { line-height: 1.45; min-width: calc(470px * var(--z)); }
/* 0.50.3 · подсказка у значка «i» — справа от значка, со стрелкой */
.info-tip { position: absolute; z-index: 90; width: max-content; max-width: min(360px, calc(100vw - 24px)); padding: 10px 14px 12px; border-radius: 12px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--surface)) 0%, var(--surface) 70%);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: 0 14px 34px rgba(0,0,0,.28), 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--fg); animation: tipIn .16s ease-out; }
.info-tip::before { content: ""; position: absolute; top: calc(var(--arrow-y, 20px) - 7px); width: 12px; height: 12px; transform: rotate(45deg);
  background: color-mix(in srgb, var(--accent) 22%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border)); }
.info-tip.right::before { left: -7px; border-top: 0; border-right: 0; }
.info-tip.left::before { right: -7px; border-bottom: 0; border-left: 0; background: var(--surface); }
.info-tip-h { display: flex; align-items: center; gap: 6px; font-size: calc(11px * var(--z)); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.info-tip-b { font-size: calc(13.5px * var(--z)); line-height: 1.5; text-align: left; }
@keyframes tipIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.info-i[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-muted); }
.vw-mod { font-style: normal; color: var(--warn, #d29922); margin-left: 1px; }
/* 0.50.4 · Доходная информация — без рамки «таблица в таблице»: направления блоками, строки сумм без сетки */
.fin-flat { border: 0; border-collapse: separate; border-spacing: 0; background: none; }
.fin-flat thead th { background: none; border-top: 0; border-bottom: 1px solid var(--border-muted); padding-top: 0; padding-bottom: calc(6px * var(--z)); text-transform: none; letter-spacing: 0; font-size: calc(12px * var(--z)); }
.fin-flat td { border-top: 0; }
.fin-flat tr.dep-head td { background: none; border-top: 1px solid var(--border-muted); padding-top: calc(12px * var(--z)); padding-bottom: calc(2px * var(--z)); }
.fin-flat tbody tr.dep-head:first-child td { border-top: 0; }
.fin-flat tr.dep-head .dep-sel { border-left: 3px solid var(--dc, var(--border)); }
.fin-flat tr.dep-head td.dep-colored { box-shadow: none; }
.fin-flat tr[data-line] td { padding-top: calc(4px * var(--z)); padding-bottom: calc(4px * var(--z)); }
.fin-flat tr.add-dep td { background: none; border-top: 1px dashed var(--border-muted); padding-top: calc(10px * var(--z)); }
.fin-flat tfoot td { background: none; border-top: 1px solid var(--border); padding-top: calc(10px * var(--z)); }
.fin-flat tfoot tr + tr td { border-top: 0; padding-top: 0; }
.fin-flat.cp-table tbody td { padding-top: calc(6px * var(--z)); }
/* 0.50.4 · признаки проекта в пункте 2 */
.proj-flags { display: grid; gap: 8px; padding: calc(12px * var(--z)) calc(14px * var(--z)); border-radius: var(--r); border: 1px solid var(--border-muted); background: var(--surface-2); max-width: calc(760px * var(--z)); }
.proj-flags-h { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.proj-flags-h > .icon { color: var(--accent); }
.proj-flags-row { gap: 10px; flex-wrap: wrap; }
.flag-chip { display: flex; align-items: flex-start; gap: 8px; flex: 1 1 260px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg); cursor: pointer; }
.flag-chip:hover { border-color: var(--accent); }
.flag-chip input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.flag-chip span { display: grid; gap: 2px; }
.flag-chip small { color: var(--fg-muted); font-size: calc(12px * var(--z)); line-height: 1.35; }
.flag-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-muted); }
/* 0.50.4 · «Итого» и «Файлы проекта» сворачиваются щелчком по заголовку — как под-чат */
.fold-win .fw-head { padding-top: 0; padding-bottom: 0; }
.fold-win .fw-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; background: none; border: 0; padding: calc(10px * var(--z)) 0; margin: 0; color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.fold-win .fw-title h3 { margin: 0; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.fold-win .fw-title .chev { display: inline-grid; color: var(--fg-muted); transition: transform .18s var(--ease); }
.fold-win .fw-head:hover { background: var(--hover); }
.fold-win.win-folded .fw-title .chev { transform: rotate(-90deg); }
.fold-win .fw-sum { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.fold-win:not(.win-folded) .fw-sum { display: none; }
.fold-win.win-folded > .box-head { border-bottom-color: transparent; }
/* 0.50.4 · «Заявки на доход»: «i» — маленький кружок у верха последней буквы; «Новая заявка» слева от поиска */
.bx-head-l h1 .h1-t { position: relative; display: inline-block; padding-right: 18px; }
.bx-head-l h1 .info-i { position: absolute; top: -2px; right: 0; width: auto; height: auto; border: 0; background: none; border-radius: 50%; padding: 0; color: var(--fg-muted); line-height: 0; }
.bx-head-l h1 .info-i:hover, .bx-head-l h1 .info-i[aria-expanded="true"] { color: var(--accent); background: none; }
.bx-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bx-row > .btn { flex: none; }
.bx-row > #lt { flex: 1 1 auto; min-width: 0; max-width: calc(640px * var(--z)); }
/* меню «Вид»: подписи и столбцы */
.vw-menu .vw-sub { display: block; margin-left: auto; padding-left: 10px; font-weight: 400; }
.vw-menu [data-vw-edit], .vw-menu [data-vw-cols] { display: flex; align-items: center; gap: 8px; }
.vw-menu [data-vw-cols] > .icon:last-child { transition: transform .15s; }
.vw-menu [data-vw-cols].open > .icon:last-child { transform: rotate(180deg); }
.vw-cols { display: grid; gap: 2px; padding: 2px 12px 8px 34px; max-height: 380px; overflow: auto; }
.vw-cols .vw-col { padding: 3px 0; font-size: calc(13px * var(--z)); }
.vw-cols .vw-cols-def { justify-self: start; margin-top: 4px; font-size: calc(12px * var(--z)) !important; color: var(--fg-muted); padding: 4px 0 !important; }
.ipf .fw-title { flex: 1 1 auto; min-width: 0; }
.ipf .fw-title h3 { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ipf .pf-seg { flex: none; }
.ipf .pf-seg button { padding: 2px 7px; font-size: calc(11.5px * var(--z)); }
.ipf.win-folded .pf-seg { display: none; }

/* 0.51 · Заявка на расход: направление на всю заявку, таблица расходов без второй рамки, менеджер контрагента */
.exp-dir { flex-wrap: wrap; }
.exp-dir button { padding: calc(7px * var(--z)) calc(16px * var(--z)); }
.exp-dir-row .field { margin: 0; }
.kv.exp-info { grid-template-columns: repeat(auto-fill, minmax(calc(180px * var(--z)), 1fr)); }
.kv.exp-info .select { max-width: calc(260px * var(--z)); }
.sec[data-sec="lines"] .exp-body { padding: 0; }
.sec[data-sec="lines"] .exp-body #dups:not(:empty) { padding: calc(12px * var(--z)) calc(16px * var(--z)) 0; }
.sec[data-sec="lines"] .exp-wrap { border: 0; border-radius: 0; background: transparent; }
.sec[data-sec="lines"] .exp-wrap.field-invalid { outline: 2px solid var(--danger); outline-offset: -2px; }
.t.exp-t { min-width: calc(1600px * var(--z)); }
.t.exp-t.ro { min-width: calc(1400px * var(--z)); }
.t.exp-t .exp-mgr { flex-wrap: nowrap; gap: 4px; }
.t.exp-t [data-f=manager], .t.exp-t [data-f=manager_contact_id] { min-width: calc(170px * var(--z)); }
.exp-dir { justify-self: start; align-self: flex-start; width: auto; max-width: 100%; }
.proj-flags[hidden] { display: none; }
/* 0.50.5 · «Информация о заказчике» и «Информация о плательщике» — поля по содержимому */
.lay[data-lay="income"] [data-sec="client"] .grid-3 { grid-template-columns: minmax(0, 380px) minmax(0, calc(170px * var(--z))) minmax(0, 280px); }
.lay[data-lay="income"] [data-sec="client"] [data-client] { max-width: 100%; }
.lay[data-lay="income"] [data-sec="payer"] .grid-2 { grid-template-columns: minmax(0, 460px) minmax(0, 520px); }
.lay[data-lay="income"] [data-sec="payer"] textarea { max-width: calc(760px * var(--z)); }
@media (max-width: 900px) { .lay[data-lay="income"] [data-sec="client"] .grid-3, .lay[data-lay="income"] [data-sec="payer"] .grid-2 { grid-template-columns: minmax(0, 1fr); } }
/* 0.50.5 · «Отправки на согласование» и сравнение */
.sent-list { display: grid; gap: 4px; max-height: calc(260px * var(--z)); overflow: auto; }
.sent-row { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 6px 8px; border: 1px solid var(--border-muted); border-radius: var(--r); background: var(--bg); color: var(--fg); cursor: pointer; font: inherit; }
.sent-row:hover { border-color: var(--accent); background: var(--accent-muted); }
.sent-row .grow { display: grid; gap: 2px; min-width: 0; }
.sent-meta { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sent-meta .muted { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sent-no { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); min-width: 26px; }
.sent-t { font-size: calc(12.5px * var(--z)); font-weight: 600; white-space: nowrap; }
.sent-res { flex: none; font-size: calc(11px * var(--z)); padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--fg-muted); white-space: nowrap; }
.sent-res.ok { color: var(--done, #3fb950); border-color: currentColor; }
.sent-res.bad { color: var(--danger); border-color: currentColor; }
.sent-res.wait { color: var(--accent); border-color: currentColor; }
.sent-acts { margin-top: 8px; gap: 6px; flex-wrap: wrap; }
.icmp-bar { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.icmp-bar label { display: grid; gap: 4px; font-size: calc(12px * var(--z)); color: var(--fg-muted); font-weight: 600; min-width: 260px; }
.icmp-bar > .icon { margin-bottom: 8px; color: var(--fg-muted); }
.icmp-sum { display: flex; align-items: center; gap: 6px; padding: 8px 12px; margin-bottom: 10px; border-radius: var(--r); background: var(--accent-muted); border: 1px solid var(--accent); }
.icmp-sum.same { background: var(--surface-2); border-color: var(--border); }
.icmp-t td { vertical-align: top; }
.icmp-t .icmp-k { color: var(--fg-muted); font-weight: 600; }
.icmp-t tr.ch .icmp-k { color: var(--fg); }
.icmp-t tr.ch td.old { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.icmp-t tr.ch td.new { background: color-mix(in srgb, var(--done, #3fb950) 14%, transparent); }
.icmp-note { margin-top: 3px; font-size: calc(11px * var(--z)); font-weight: 400; color: var(--fg-muted); display: flex; align-items: center; gap: 4px; }
/* 0.50.5 · правая колонка заявки: заголовки окон одной высоты */
.lay[data-lay="income"] [data-zone="side"] > [data-win] > .box-head { min-height: calc(44px * var(--z)); height: calc(44px * var(--z)); padding-top: 0; padding-bottom: 0; box-sizing: border-box; display: flex; align-items: center; }
.lay[data-lay="income"] [data-zone="side"] > [data-win] > .box-head .fw-title, .lay[data-lay="income"] [data-zone="side"] > [data-win] > .box-head .mc-title { padding-top: 0; padding-bottom: 0; align-self: stretch; }
/* 0.51.3 · заявка на доход — «лист» по центру экрана, а не на всю ширину */
#view:has(> form.lay[data-lay="income"]) { max-width: calc(1240px * var(--z)); margin-inline: auto; }
/* 0.51.3 · справочник налогообложения: таблица не вылезает за окно */
.dk-scroll { overflow-x: auto; }
.dk-t.dk-fml .fml-ex { min-width: calc(300px * var(--z)); white-space: normal; overflow-wrap: anywhere; }
.dk-t.dk-fml td [data-f=value] { min-width: calc(160px * var(--z)) !important; }
/* 0.51.3 · «Доходная информация» карточками */
.fl-steps { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 8px 12px; border-radius: var(--r); background: var(--surface-2); color: var(--fg-muted); font-size: calc(12.5px * var(--z)); }
.fl-steps > .icon { color: var(--fg-subtle, var(--fg-muted)); }
.fl-steps b { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 4px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; }
table.fin-cards { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 10px; }
table.fin-cards td { padding: 0; border: 0; background: none; }
table.fin-cards tr.dep-head td { padding-top: 12px; }
table.fin-cards tr.dep-head:first-child td { padding-top: 0; }
.fl-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-bottom: 0; border-left: 4px solid var(--dc); border-radius: var(--r) var(--r) 0 0; background: var(--surface-2); }
.fl-no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--dc); color: #fff; font-weight: 700; font-size: 12px; flex: none; text-shadow: 0 0 2px rgba(0,0,0,.4); }
.fl-head .dep-sel { width: auto; min-width: calc(240px * var(--z)); font-weight: 600; }
.fl-head .dep-sum { font-weight: 600; font-variant-numeric: tabular-nums; }
.fl-tr > td > .fl-row { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; padding: 10px 12px 12px; border: 1px solid var(--border); border-top: 1px dashed var(--border-muted); border-left: 4px solid var(--dc); background: var(--bg); }
.fl-tr:has(+ .fl-tr) > td > .fl-row { border-bottom: 0; }
.fl-tr:not(:has(+ .fl-tr)) > td > .fl-row { border-radius: 0 0 var(--r) var(--r); }
.fl-f { display: grid; gap: 4px; min-width: 0; }
.fl-l { font-size: calc(11.5px * var(--z)); color: var(--fg-muted); font-weight: 600; white-space: nowrap; }
.fl-l i { color: var(--danger); font-style: normal; }
.fl-sum .input { width: calc(150px * var(--z)); font-weight: 600; }
.fl-tax .select { width: calc(200px * var(--z)); }
.fl-type .select { width: calc(170px * var(--z)); }
.fl-cmt { flex: 1 1 180px; }
.fl-cmt .input { width: 100%; max-width: calc(320px * var(--z)); }
.fl-coef { margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--accent-muted); color: var(--accent); font-weight: 700; font-size: calc(11px * var(--z)); }
.fl-coef:empty { display: none; }
.fl-op { align-self: center; margin-top: calc(18px * var(--z)); color: var(--fg-muted); font-weight: 700; font-size: 16px; line-height: 1; }
.fl-acts { align-self: center; margin-top: calc(18px * var(--z)); display: flex; gap: 2px; }
table.fin-cards tr.add-dep td { padding-top: 10px; }
.fl-add { border-style: dashed; }
.fl-total { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface-2); }
.fl-total .fl-op { margin-top: 14px; }
.fl-tv { font-size: calc(18px * var(--z)); font-weight: 600; font-variant-numeric: tabular-nums; }
.fl-tv.strong { font-size: calc(20px * var(--z)); font-weight: 800; }
.fl-bytax { flex-basis: 100%; }
.fl-bytax .by-tax:empty { display: none; }
@media (max-width: 760px) { .fl-op { display: none; } .fl-sum .input, .fl-tax .select { width: 100%; } .fl-f { flex: 1 1 140px; } }
.fl-steps-r { margin-left: auto; font-style: italic; }
table.fin-cards, table.fin-cards tbody, table.fin-cards tr, table.fin-cards td { max-width: 100%; }
table.fin-cards { table-layout: fixed; }
.fl-tr > td > .fl-row { box-sizing: border-box; width: 100%; }
.fl-cmt { flex: 1 1 160px; min-width: 120px; }
.fl-cmt .input { box-sizing: border-box; }
@media (min-width: 1100px) { .fl-tr > td > .fl-row:not(:has(.fl-type)) { flex-wrap: nowrap; } .fl-row:not(:has(.fl-type)) .fl-cmt { flex: 1 1 0; min-width: 90px; } .fl-acts { flex: none; } }
/* 0.51.5 · под-чат: сколько новых сообщений — горит в заголовке */
.counter.mc-new { flex: none; margin-left: 6px; background: var(--danger); color: #fff; border-color: transparent; font-weight: 700; box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 60%, transparent); animation: mcNew 1.8s ease-out infinite; }
.counter.mc-new[hidden] { display: none; }
.mchat:not(.win-folded) .counter.mc-new { display: inline-block; }
.mchat:not(.win-folded) .counter.mc-new[hidden] { display: none; }
@keyframes mcNew { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 55%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .mc-new { animation: none; } }
/* 0.51.5 · «Версии заявки» в доходе — как в расходе */
.ivers .ver-foot { margin-top: 8px; gap: 6px; align-items: center; }
.ivers .ver-it.cur { background: none; }
.ivers .label { font-size: calc(10.5px * var(--z)); }
.icmp-bar [data-cmp-mode][hidden] { display: none; }
/* 0.51.7 · список «Заявки на доход»: скрыли столбцы — оставшиеся не растягиваются, таблица просто короче справа */
.lay[data-lay="list_income"] table.req-list { width: auto; max-width: 100%; }
.lay[data-lay="list_income"] table.req-list thead th { white-space: nowrap; }
.lay[data-lay="list_income"] table.req-list td.dir-tags { min-width: calc(160px * var(--z)); max-width: calc(320px * var(--z)); }

/* 0.52 · Заявка на расход: блоки по отделам, карточка контрагента строки */
.t.exp-t { min-width: calc(1080px * var(--z)); }
.t.exp-t.ro { min-width: calc(980px * var(--z)); }
.t.exp-t tr.exp-grp-h > td { background: var(--surface-2); padding: calc(6px * var(--z)) calc(10px * var(--z)); border-top: 1px solid var(--border); }
.t.exp-t tr.exp-grp-h + tr > td { border-top: 0; }
.exp-grp-row { display: flex; align-items: center; gap: calc(10px * var(--z)); min-height: calc(32px * var(--z)); position: sticky; left: 0; }
.exp-grp-row .select.exp-grp-dep { width: auto; min-width: calc(200px * var(--z)); font-weight: 650; }
.exp-grp-sum { color: var(--fg-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.exp-grp-sum b { color: var(--fg); font-weight: 650; }
.exp-add-dep { width: auto; min-width: calc(190px * var(--z)); }
.t.exp-t td.cp-td { min-width: calc(220px * var(--z)); max-width: calc(300px * var(--z)); }
.exp-cp { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: calc(32px * var(--z)); padding: calc(5px * var(--z)) calc(26px * var(--z)) calc(5px * var(--z)) calc(9px * var(--z));
  border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); color: var(--fg); font: inherit; text-align: left; cursor: pointer; position: relative; }
.exp-cp:hover { border-color: var(--accent); }
.exp-cp.ro { border: 0; padding: 0; background: none; cursor: default; min-height: 0; }
.exp-cp-name { font-size: calc(13px * var(--z)); line-height: 1.3; overflow-wrap: anywhere; }
.exp-cp-sub { font-size: calc(11.5px * var(--z)); color: var(--fg-muted); line-height: 1.3; overflow-wrap: anywhere; }
.exp-cp-edit { position: absolute; right: 7px; top: calc(9px * var(--z)); color: var(--fg-subtle); }
.exp-cpd .section-title { margin-top: 4px; }
.exp-cpd .span-2 { grid-column: span 2; }
.exp-grp-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.lay[data-lay="list_income"] table.req-list td.c-project { width: calc(300px * var(--z)); max-width: calc(300px * var(--z)); }

/* 0.52.1 · Расход: описание в окне, итоги блока слева; списки заявок — столбцы не растягиваются */
.t.exp-t td.desc-td { min-width: calc(240px * var(--z)); }
.exp-desc { display: block; width: 100%; min-height: calc(32px * var(--z)); padding: calc(6px * var(--z)) calc(26px * var(--z)) calc(6px * var(--z)) calc(9px * var(--z)); position: relative;
  border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); color: var(--fg); font: inherit; font-size: calc(13px * var(--z)); text-align: left; cursor: text; line-height: 1.35; }
.exp-desc:hover, .exp-desc:focus-visible, .exp-cp:focus-visible { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--accent-muted); }
.exp-desc-t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; }
.exp-desc-ta { min-height: calc(180px * var(--z)); resize: vertical; }
.exp-grp-sum { margin-left: calc(4px * var(--z)); }
.t.req-list { width: max-content; min-width: 0; }

/* ---------- 0.52.5 · Закрытие: кнопка «Подробнее» и окно «что нужно для закрытия» ---------- */
.dir-cell .btn.dir-more { width: 100%; justify-content: center; color: var(--fg-muted); }
.dir-cell .btn.dir-more.warn { border-color: var(--attention); color: var(--attention); background: var(--attention-muted); }
.cl-more-head { margin-bottom: 12px; }
.cl-steps { display: grid; gap: 10px; }
.cl-step { border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--r); padding: 10px 12px; display: grid; gap: 6px; line-height: 1.45; }
.cl-step-t { display: flex; align-items: center; gap: 6px; }
.cl-step.bad { border-left-color: var(--danger); } .cl-step.bad .cl-step-t { color: var(--danger); }
.cl-step.warn { border-left-color: var(--attention); } .cl-step.warn .cl-step-t { color: var(--attention); }
.cl-step.info { border-left-color: var(--accent, var(--border)); }
.cl-step.ok { border-left-color: var(--success); } .cl-step.ok .cl-step-t { color: var(--success); }
.cl-step-l { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- 0.54.3 · Закрытие: компактные ячейки направлений (срок + маленькие кнопки в одну строку) ---------- */
.t.closing td.dir { min-width: 0; width: auto; padding-top: calc(5px * var(--z)); padding-bottom: calc(5px * var(--z)); }
.t.closing .dir-cell { display: flex; align-items: center; gap: 6px; min-width: calc(150px * var(--z)); flex-wrap: nowrap; }
.t.closing .dir-acts { display: inline-flex; gap: 4px; margin-left: auto; }
.t.closing .dir-cell .btn.dir-more { width: calc(28px * var(--z)); }
.t.closing .dir-cell .btn.sm.close-btn { border-color: var(--success); color: var(--success); white-space: nowrap; }
.t.closing .dir-cell .btn.sm.close-btn:hover { background: var(--success-muted); }
.t.closing .dir-cell .btn.sm.close-btn.hot { border-color: var(--danger); background: var(--danger); color: #fff; }
.t.closing .dir-cell .btn.sm.close-btn.blocked { opacity: .55; }
.dl-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2);
  font-size: calc(12.5px * var(--z)); font-weight: 650; white-space: nowrap; }
.dl-chip.hot { border-color: var(--danger); background: var(--danger-muted); color: var(--danger); }
.dl-chip.none { color: var(--fg-muted); font-weight: 500; }
.dl-chip.closed { border-color: var(--success); background: var(--success-muted); color: var(--success); }
.dl-chip.rq { border-color: var(--attention); background: var(--attention-muted); color: var(--attention); }
.modal .close-btn.blocked[disabled] { opacity: .5; }

/* ---------- 0.54.4 · Закрытие: срок ≤ 5 дней — оранжевым, просрочено — красным ---------- */
:root { --cl-soon: #f0883e; --cl-soon-muted: rgba(240, 136, 62, .16); }
.dl-chip.soon { border-color: var(--cl-soon); background: var(--cl-soon-muted); color: var(--cl-soon); }
.t.closing .dir-cell .btn.sm.close-btn.soon { border-color: var(--cl-soon); background: var(--cl-soon); color: #fff; }
/* 0.52.2 · подсказки общего поиска — поверх строки разделов и всех окон страницы */
.gsearch { z-index: 75; }
.gsearch .results { z-index: 75; left: auto; right: 0; width: max(100%, calc(440px * var(--z))); max-width: calc(100vw - 24px); }
.gsearch .results a > :first-child { flex: none; }

/* 0.58.1 · Расход: меню строки «⋯», копирование в другую заявку */
.exp-row-menu kbd { font-size: calc(10.5px * var(--z)); opacity: .7; white-space: nowrap; }
.exp-row-menu button[disabled] { opacity: .45; cursor: default; }
.exp-row-menu hr { border: 0; border-top: 1px solid var(--border-muted); margin: 4px 0; }
.exp-row-menu .menu-sub-list { padding-left: calc(14px * var(--z)); max-height: calc(220px * var(--z)); overflow: auto; }
.exp-req-list { max-height: calc(320px * var(--z)); overflow: auto; border: 1px solid var(--border); border-radius: var(--r); }
.exp-req { display: flex; align-items: center; gap: calc(10px * var(--z)); width: 100%; padding: calc(8px * var(--z)) calc(10px * var(--z)); border: 0; border-bottom: 1px solid var(--border-muted); background: none; color: var(--fg); font: inherit; text-align: left; cursor: pointer; }
.exp-req:hover { background: var(--surface-2); }
.exp-req.on { background: var(--accent-muted); box-shadow: inset 3px 0 0 var(--accent); }
.exp-req .ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 0.69.2 · заявка на доход: «i» у «Срочной заявки»; налог, заданный типом заявки; список незаполненного закреплён при прокрутке */
.urgent-row { display: flex; align-items: center; gap: 8px; }
.urgent-row .info-i { width: 26px; height: 26px; border: 0; background: none; color: var(--fg-muted); padding: 0; display: inline-grid; place-items: center; cursor: pointer; border-radius: 50%; }
.urgent-row .info-i:hover, .urgent-row .info-i[aria-expanded="true"] { color: var(--accent); background: var(--accent-muted); }
.fl-forced { opacity: 1 !important; background: var(--surface-2); cursor: not-allowed; }
.fl-lock { margin-left: 4px; color: var(--fg-muted); vertical-align: -1px; }
[data-errors].err-sticky { position: sticky; top: calc(var(--hdr-h, 64px) + 8px); z-index: 25; }
[data-errors].err-sticky .notice { box-shadow: 0 10px 28px rgba(0,0,0,.28); background: color-mix(in srgb, var(--danger) 14%, var(--surface)); }
[data-errors].err-sticky .err-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
[data-errors].err-sticky .err-list { max-height: 26vh; overflow: auto; margin: 6px 0 8px; }
[data-errors].err-sticky.err-min .err-list, [data-errors].err-sticky.err-min [data-err-next] { display: none; }
[data-errors].err-sticky.err-min [data-err-min] .icon { transform: rotate(-90deg); }
:root.hdr-hide [data-errors].err-sticky { top: calc(var(--hdr-h, 64px) - var(--hdr-hide, 0px) + 8px); }
.fl-sum, .fl-tax, .fl-type, .fl-op { flex: none; }
.fl-row:has(.fl-type) .fl-cmt { flex: 1 1 200px; }
[data-errors].err-sticky .err-list { columns: 2; column-gap: 28px; }
@media (max-width: 900px) { [data-errors].err-sticky .err-list { columns: 1; } }
[data-errors].err-sticky .notice.ok { background: color-mix(in srgb, var(--success, #3fb950) 16%, var(--surface)); border-color: color-mix(in srgb, var(--success, #3fb950) 50%, transparent); }
