
:root {
	/* акцент — синий ОСК (фирстиль) */
	--primary: #1E40AF;
	--primary-soft: rgba(30,64,175,0.10);
	--primary-hover: #1B3A9E;
	/* светлая воздушная палитра Emilus */
	--bg: #F5F7FA;
	--card: #FFFFFF;
	--text: #1A2027;
	--text-2: #6B7280;
	--border: #EDF0F3;
	--hover: #F9FAFB;
	/* статусы (мягкие) */
	--success: #22C55E;
	--warning: #F59E0B;
	--danger: #EF4444;
	/* мягкие тени Emilus — карточки чуть парят */
	--shadow: 0 1px 4px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
	--shadow-md: 0 4px 16px rgba(0,0,0,0.06), 0 2px 6px rgba(0,0,0,0.03);
	--ring: 0 0 0 3px rgba(30,64,175,0.14);
	--ease: cubic-bezier(0.4, 0, 0.2, 1);
	--radius: 12px;
	--radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
	font-family: "Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	background: var(--bg);
	color: var(--text);
	display: flex;
	flex-direction: row;
	min-height: 100vh;
	font-size: 14px;
	line-height: 1.55;
	font-weight: 400;
}

.tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ==================== ЛЕВЫЙ САЙДБАР (Волна 5, эталон ОСК) ====================
   Слева вертикальный сайдбар: бренд + оперативные контуры (верхний блок без
   заголовка) + секции с заголовками (Справочники / Система / Справка). Пустая
   секция исчезает (гейт в Go). На узком экране — off-canvas по бургеру. */
.sidebar {
	width: 252px; flex-shrink: 0;
	background: var(--card);
	border-right: 1px solid var(--border);
	box-shadow: 1px 0 3px rgba(0,0,0,0.02);
	display: flex; flex-direction: column;
	position: sticky; top: 0; height: 100vh;
	overflow: hidden;
}
.sidebar .brand {
	display: flex; align-items: center; gap: 12px;
	padding: 18px 22px; height: 68px; flex-shrink: 0;
	text-decoration: none;
	border-bottom: 1px solid var(--border);
}
.brand-logo-img { display: block; height: 38px; width: auto; max-width: 100%; }

.sidebar nav {
	padding: 10px 14px 20px;
	display: flex; flex-direction: column; gap: 3px;
	overflow-y: auto; flex: 1;
}
.nav-label {
	font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
	color: #9AA4B2; font-weight: 600; padding: 16px 12px 6px;
}
.nav-item {
	display: flex; align-items: center; gap: 12px;
	padding: 10px 12px;
	color: var(--text-2);
	cursor: pointer; text-decoration: none;
	border-radius: var(--radius-sm);
	font-size: 14px; font-weight: 400;
	transition: background 160ms var(--ease), color 160ms var(--ease);
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-active {
	background: var(--primary-soft);
	color: var(--primary);
	font-weight: 600;
}
.nav-item .ico { width: 18px; height: 18px; flex-shrink: 0; }
.nav-active .ico { color: var(--primary); }

/* ==================== MAIN / TOPBAR / CONTOUR-TABS ==================== */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* верхняя полоса контента: бургер (узко) + язык/юзер справа */
.topbar {
	display: flex; align-items: center;
	height: 60px; padding: 0 32px; gap: 16px;
	background: var(--card);
	border-bottom: 1px solid var(--border);
	position: sticky; top: 0; z-index: 15;
}
.topbar-spacer { flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
/* вкладка «Склад» в шапке (Волна 3) — рядом с переключателем языка, не в боковом меню */
.tb-tab {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 8px 14px; border-radius: var(--radius-sm);
	border: 1px solid var(--border); background: var(--card);
	color: var(--text-2); font-size: 13.5px; font-weight: 500;
	text-decoration: none; white-space: nowrap;
	transition: all 160ms var(--ease);
}
.tb-tab:hover { border-color: var(--primary); color: var(--primary); }
.tb-tab .ico { width: 16px; height: 16px; }
/* на узком экране оставляем иконку — подпись съедает всю шапку рядом с языком и юзером */
@media (max-width: 720px) { .tb-tab span { display: none; } }
.burger {
	display: none;
	flex-direction: column; gap: 4px;
	width: 38px; height: 38px; padding: 9px 8px;
	border: 1px solid var(--border); border-radius: var(--radius-sm);
	background: transparent; cursor: pointer;
}
.burger span { display: block; height: 2px; background: var(--text-2); border-radius: 2px; }

/* ярус 2 — суб-табы активного контура (в шапке контента) */
.contour-tabs {
	display: flex; align-items: center; gap: 2px;
	flex-wrap: wrap;
	margin-bottom: 20px;
	border-bottom: 1px solid var(--border);
}
.contour-tab {
	display: inline-flex; align-items: center;
	padding: 0 14px; height: 42px;
	color: var(--text-2);
	text-decoration: none; white-space: nowrap;
	font-size: 13.5px; font-weight: 400;
	border-bottom: 2px solid transparent;
	transition: color 160ms var(--ease), border-color 160ms var(--ease);
}
.contour-tab:hover { color: var(--text); }
.contour-tab.on {
	color: var(--primary);
	font-weight: 600;
	border-bottom-color: var(--primary);
}

/* off-canvas на узком экране */
.sidebar-scrim {
	display: none;
	position: fixed; inset: 0; z-index: 29;
	background: rgba(15,23,42,.42);
}
@media (max-width: 900px) {
	.sidebar {
		position: fixed; left: 0; top: 0; z-index: 30;
		transform: translateX(-100%);
		transition: transform 220ms var(--ease);
	}
	body.nav-open .sidebar { transform: translateX(0); }
	body.nav-open .sidebar-scrim { display: block; }
	.burger { display: flex; }
	.topbar { padding: 0 16px; }
	.content { padding: 22px 16px 32px; }
}
.top-icon-btn {
	width: 38px; height: 38px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	color: var(--text-2); cursor: pointer; border: none; background: transparent;
	transition: background 160ms var(--ease), color 160ms var(--ease);
}
.top-icon-btn:hover { background: var(--hover); color: var(--text); }
.avatar {
	width: 38px; height: 38px; border-radius: 50%;
	background: var(--primary-soft); color: var(--primary);
	display: flex; align-items: center; justify-content: center;
	font-weight: 600; font-size: 13px; cursor: pointer;
}

/* ==================== ХАБ СПРАВОЧНИКОВ (плитки, эталон ОСК RefHub) ==================== */
.ref-hub-section { margin-bottom: 30px; }
.ref-hub-section:last-child { margin-bottom: 0; }
.ref-hub-label {
	font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
	color: #9AA4B2; font-weight: 600; margin-bottom: 12px;
}
.ref-tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.ref-tile {
	display: flex; align-items: flex-start; gap: 14px;
	background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
	box-shadow: var(--shadow); padding: 18px;
	text-decoration: none; color: inherit; cursor: pointer;
	transition: box-shadow 200ms var(--ease), transform 140ms var(--ease), border-color 160ms var(--ease);
}
.ref-tile:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: #C7D6EF; }
.ref-tile:focus-visible { outline: none; box-shadow: var(--ring); }
.ref-tile-ico {
	width: 44px; height: 44px; flex-shrink: 0;
	display: flex; align-items: center; justify-content: center;
	border-radius: 10px; background: var(--primary-soft); color: var(--primary);
}
.ref-tile-ico .ico { width: 22px; height: 22px; }
.ref-tile-body { min-width: 0; }
.ref-tile-title { font-size: 14.5px; font-weight: 600; color: var(--text); line-height: 1.3; }
.ref-tile-desc { font-size: 12.5px; color: var(--text-2); margin-top: 3px; line-height: 1.45; }
.ref-tile-open {
	display: inline-flex; align-items: center; gap: 4px;
	font-size: 12.5px; color: var(--primary); font-weight: 500; margin-top: 8px;
}
.ref-tile-open .ico { width: 14px; height: 14px; transition: transform 160ms var(--ease); }
.ref-tile:hover .ref-tile-open .ico { transform: translateX(3px); }

/* ==================== СПРАВОЧНЫЕ СТРАНИЦЫ (help.templ) ==================== */
.help-intro { padding: 20px 22px; margin-bottom: 18px; }
.help-intro-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.help-intro-head .ico { width: 20px; height: 20px; color: var(--primary); flex-shrink: 0; }
.help-intro-head h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--primary); }
.help-intro p { margin: 0 0 8px; font-size: 13.5px; line-height: 1.65; color: var(--text-2); max-width: 960px; }
.help-intro p:last-child { margin-bottom: 0; }

.help-steps { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.help-step {
	display: flex; align-items: flex-start; gap: 14px;
	background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
	box-shadow: var(--shadow); padding: 16px 18px;
}
.help-step-num {
	width: 30px; height: 30px; flex-shrink: 0;
	display: flex; align-items: center; justify-content: center;
	border-radius: 8px; background: var(--primary-soft); color: var(--primary);
	font-weight: 700; font-size: 14px;
}
.help-step-body { min-width: 0; }
.help-step-title { font-size: 14.5px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.help-step-body p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--text-2); max-width: 900px; }

.help-callout {
	border-radius: var(--radius); padding: 14px 18px; margin-bottom: 14px;
	border: 1px solid var(--border); border-left-width: 3px;
	background: var(--card);
}
.help-callout.tone-good { border-left-color: var(--success); background: rgba(34,197,94,.05); }
.help-callout.tone-warn { border-left-color: var(--warning); background: rgba(245,158,11,.06); }
.help-callout.tone-info { border-left-color: var(--primary); background: var(--primary-soft); }
.help-callout-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.help-callout p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--text-2); max-width: 920px; }

.help-legend-card { padding: 16px 20px; margin-bottom: 18px; }
.help-legend-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.help-legend-row { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 12px; }
.help-lg { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.lg-box {
	display: inline-flex; align-items: center; justify-content: center;
	width: 22px; height: 22px; border-radius: 6px; font-weight: 700; font-size: 13px;
}
.lg-allow { background: rgba(34,197,94,.14); color: var(--success); }
.lg-deny { background: rgba(239,68,68,.12); color: var(--danger); }
.lg-inherit { background: var(--bg); color: var(--text-2); border: 1px dashed var(--border); }
.help-priority {
	font-size: 12.5px; line-height: 1.6; color: var(--text-2);
	background: var(--bg); border-radius: 8px; padding: 10px 12px;
}

/* ==================== АКТЫ · 1С — каркас-пояснение флоу ==================== */
.acts-flow-card { margin-bottom: 18px; }
.acts-flow-lead { font-size: 13.5px; line-height: 1.6; color: var(--text-2); max-width: 940px; margin: 0 0 14px; }
.acts-flow-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.acts-flow-step {
	display: inline-flex; align-items: center; gap: 8px;
	background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
	padding: 6px 14px 6px 6px; font-size: 13px; color: var(--text);
}
.acts-flow-num {
	width: 22px; height: 22px; border-radius: 50%;
	display: inline-flex; align-items: center; justify-content: center;
	background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 12px;
}
.acts-flow-arr { color: #C7CDD6; font-size: 16px; }
.acts-types { display: flex; flex-wrap: wrap; gap: 8px; }
.acts-type-chip {
	font-size: 12px; padding: 4px 10px; border-radius: 6px;
	background: var(--primary-soft); color: var(--primary); font-weight: 500;
}

/* ==================== CONTENT (воздух!) ==================== */
.content { padding: 28px 32px 40px; flex: 1; }
.page-head { margin-bottom: 24px; }
.page-crumbs { font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.page-crumbs .sep { margin: 0 7px; color: #C7CDD6; }
h1 { font-size: 24px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.page-sub { color: var(--text-2); margin-top: 5px; font-size: 14px; }

/* ==================== STAT CARDS (Emilus KPI) ==================== */
.stat-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 22px;
	margin-bottom: 24px;
}
.stat-card {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 22px 24px;
	display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
	transition: box-shadow 200ms var(--ease), transform 140ms var(--ease);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
/* KPI drill-through (Волна 5): карточка-ссылка */
.stat-card-link { text-decoration: none; color: inherit; cursor: pointer; }
.stat-card-link:hover { border-color: var(--primary); }
.stat-card-link:focus-visible { outline: none; box-shadow: var(--ring); }
.stat-go { color: #C7CDD6; flex-shrink: 0; align-self: center; transition: color 160ms var(--ease), transform 160ms var(--ease); }
.stat-go .ico { width: 18px; height: 18px; }
.stat-card-link:hover .stat-go { color: var(--primary); transform: translateX(3px); }
.stat-label { font-size: 13px; color: var(--text-2); font-weight: 400; margin-bottom: 10px; }
.stat-value { font-size: 28px; font-weight: 600; color: var(--text); line-height: 1; letter-spacing: -0.02em; }
.stat-delta { font-size: 12.5px; font-weight: 500; margin-top: 9px; display: inline-flex; align-items: center; gap: 4px; }
.delta-up { color: var(--success); }
.delta-down { color: var(--danger); }
.stat-ico {
	width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
	display: flex; align-items: center; justify-content: center;
}
.stat-ico svg { width: 22px; height: 22px; }
.tone-blue  { background: rgba(30,64,175,0.10);  color: var(--primary); }
.tone-green { background: rgba(34,197,94,0.12);  color: var(--success); }
.tone-amber { background: rgba(245,158,11,0.13); color: var(--warning); }
.tone-red   { background: rgba(239,68,68,0.11);  color: var(--danger); }

/* ==================== CARD / PANEL ==================== */
.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 22px; align-items: start; margin-bottom: 22px; }
@media (max-width: 1080px) { .grid-2 { grid-template-columns: 1fr; } }
.card {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
	transition: box-shadow 200ms var(--ease);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-head {
	display: flex; align-items: center; justify-content: space-between;
	padding: 18px 24px;
	border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text); }
.card-link { font-size: 13px; color: var(--primary); text-decoration: none; font-weight: 500; cursor: pointer; }
.card-link:hover { text-decoration: underline; }
.card-body { padding: 20px 24px; }

/* ==================== BUTTONS ==================== */
.btn-primary {
	display: inline-flex; align-items: center; gap: 8px;
	background: var(--primary); color: #fff; border: none;
	padding: 10px 18px; border-radius: var(--radius-sm);
	font-family: inherit; font-weight: 500; font-size: 14px;
	cursor: pointer; white-space: nowrap;
	transition: background 160ms var(--ease), box-shadow 160ms var(--ease);
}
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 12px rgba(30,64,175,0.22); }
.btn-primary:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary svg { width: 16px; height: 16px; }
.btn-primary:disabled { background: #C7D0DE; color: #F0F3F8; cursor: not-allowed; box-shadow: none; }
.btn-primary:disabled:hover { background: #C7D0DE; box-shadow: none; }

/* Кнопка «Экспорт в Excel» — вторичная (обводка, зелёный акцент Excel). */
.btn-secondary {
	display: inline-flex; align-items: center; gap: 6px;
	background: #fff; color: var(--text); border: 1px solid #C7D6EF;
	padding: 9px 16px; border-radius: var(--radius-sm);
	font-family: inherit; font-weight: 500; font-size: 14px;
	cursor: pointer; white-space: nowrap; text-decoration: none;
	transition: border-color 160ms var(--ease), background 160ms var(--ease);
}
.btn-secondary:hover { border-color: #1D8348; background: #F3FBF6; color: #1D8348; }
.btn-export .btn-export-ico { font-weight: 700; color: #1D8348; }

/* ==================== TABLE (воздушная) ==================== */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
	text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
	color: #9AA4B2; padding: 12px 24px; font-weight: 600;
	border-bottom: 1px solid var(--border); white-space: nowrap;
}
.th-right { text-align: right; }
td { padding: 14px 24px; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text); white-space: nowrap; }
.td-right { text-align: right; }
tbody tr { transition: background 150ms var(--ease); cursor: pointer; }
tbody tr:hover { background: var(--hover); }
tbody tr:last-child td { border-bottom: none; }
.cell-strong { font-weight: 600; color: var(--text); }
.mono { font-variant-numeric: tabular-nums; }
/* .num — числовая колонка (меры тн/м/шт и прочие количества): выравнивание вправо, чтобы
   разряды стояли под разрядами и прочерк читался как отсутствие меры, а не как часть числа.
   Класс уже стоял в разметке трёх-мерных таблиц, но ПРАВИЛА под ним не было — колонки
   ехали влево. Определён здесь один раз на все такие таблицы. */
.num { text-align: right; }
.muted { color: var(--text-2); }

/* ==================== BADGES (мягкие pill) ==================== */
.badge {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 4px 11px; border-radius: 9999px;
	font-size: 12px; font-weight: 500; line-height: 1.5; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-gray  { background: #F1F3F6; color: #6B7280; }
.badge-blue  { background: rgba(30,64,175,0.10);  color: var(--primary); }
.badge-green { background: rgba(34,197,94,0.13);  color: #15803D; }
.badge-slate { background: #EEF1F5; color: #475569; }

/* ==================== BAR WIDGET ==================== */
.bar-row { display: flex; align-items: center; gap: 14px; padding: 9px 0; }
.bar-lbl { font-size: 13.5px; color: var(--text); width: 100px; flex-shrink: 0; }
.bar-track { flex: 1; height: 8px; background: #EEF1F5; border-radius: 9999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 9999px; transition: width 500ms var(--ease); }
.bar-blue  { background: var(--primary); }
.bar-green { background: var(--success); }
.bar-amber { background: var(--warning); }
.bar-slate { background: #94A3B8; }
.bar-val { font-size: 13px; color: var(--text-2); width: 34px; text-align: right; font-variant-numeric: tabular-nums; }

/* ==================== ACTIVITY TIMELINE (мягкий) ==================== */
.act { display: flex; gap: 14px; padding: 11px 0; }
.act:not(:last-child) { border-bottom: 1px solid var(--border); }
.act-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.dot-blue  { background: var(--primary); }
.dot-green { background: var(--success); }
.dot-amber { background: var(--warning); }
.dot-red   { background: var(--danger); }
.act-body { flex: 1; }
.act-what { font-size: 13.5px; color: var(--text); font-weight: 500; }
.act-meta { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.act-when { font-size: 12px; color: #9AA4B2; font-variant-numeric: tabular-nums; }

/* ==================== доп. badges (по контракту статусов) ==================== */
.badge-indigo { background: rgba(99,102,241,0.12); color: #4F46E5; }
.badge-amber  { background: rgba(245,158,11,0.14); color: #B45309; }
.badge-red    { background: rgba(239,68,68,0.11);  color: #DC2626; }

/* risk dots */
.risk { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }
.risk-d { width: 8px; height: 8px; border-radius: 50%; }
.risk-low  .risk-d, .risk-low  { color: #16A34A; }
.risk-med  .risk-d, .risk-med  { color: #F59E0B; }
.risk-high .risk-d, .risk-high { color: #EF4444; }
.risk-crit .risk-d, .risk-crit { color: #B91C1C; }
.risk-low .risk-d  { background: #16A34A; }
.risk-med .risk-d  { background: #F59E0B; }
.risk-high .risk-d { background: #EF4444; }
.risk-crit .risk-d { background: #B91C1C; }

/* ==================== CHARTS ==================== */
.donut-wrap { display: flex; align-items: center; gap: 26px; }
.donut { flex-shrink: 0; }
.donut-center { text-anchor: middle; }
.donut-total { font-size: 26px; font-weight: 600; fill: var(--text); }
.donut-total-lbl { font-size: 11px; fill: var(--text-2); }
.donut-seg { transition: stroke-width 200ms var(--ease); cursor: pointer; }
.donut-seg:hover { stroke-width: 22; }
.legend { display: flex; flex-direction: column; gap: 9px; flex: 1; }
.legend-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.legend-name { color: var(--text); flex: 1; }
.legend-val { color: var(--text-2); font-variant-numeric: tabular-nums; font-weight: 500; }

.chart-area .grid { stroke: var(--border); stroke-width: 1; }
.chart-area .grid-lbl { fill: #9AA4B2; font-size: 10px; }
.chart-area .axis-lbl { fill: #9AA4B2; font-size: 10.5px; text-anchor: middle; }
.chart-legend { display: flex; gap: 18px; margin-bottom: 6px; }
.chart-legend-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.chart-legend-item .cl-line { width: 16px; height: 3px; border-radius: 2px; }

/* ==================== TABLE polish (Filament-вдохновение, Emilus-лёгкость) ==================== */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.tb-search {
	display: flex; align-items: center; gap: 9px;
	background: var(--card); border: 1px solid var(--border);
	border-radius: var(--radius-sm); padding: 9px 14px; color: var(--text-2);
	min-width: 280px; box-shadow: var(--shadow);
	transition: box-shadow 160ms var(--ease), border-color 160ms var(--ease);
}
.tb-search:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.tb-search input { border: none; outline: none; background: transparent; flex: 1; font-family: inherit; font-size: 14px; color: var(--text); }
.tb-search .ico { width: 16px; height: 16px; }
.chip-filter {
	display: inline-flex; align-items: center; gap: 7px;
	background: var(--card); border: 1px solid var(--border); color: var(--text-2);
	padding: 8px 14px; border-radius: 9999px; font-size: 13px; font-weight: 500;
	cursor: pointer; box-shadow: var(--shadow); transition: all 160ms var(--ease);
}
.chip-filter:hover { border-color: #C7D6EF; color: var(--text); }
.chip-filter.on { background: var(--primary-soft); border-color: transparent; color: var(--primary); font-weight: 600; }
.chip-filter .cnt { font-size: 11.5px; opacity: .7; font-variant-numeric: tabular-nums; }
.tb-spacer { flex: 1; }

/* sortable header indicator */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--primary); }
th .sort-ico { display: inline-block; width: 12px; height: 12px; vertical-align: -2px; margin-left: 4px; opacity: .5; }
th.sorted .sort-ico { opacity: 1; color: var(--primary); }

/* row actions (hover) */
.row-actions { display: inline-flex; gap: 4px; opacity: 0; transition: opacity 150ms var(--ease); }
tbody tr:hover .row-actions { opacity: 1; }
.row-link { background: transparent; border: 0; padding: 0; margin: 0; font: inherit; color: var(--primary); cursor: pointer; text-align: left; }
.row-link:hover { text-decoration: underline; }
.row-act {
	width: 30px; height: 30px; border-radius: 7px; border: none; background: transparent;
	color: var(--text-2); display: inline-flex; align-items: center; justify-content: center;
	cursor: pointer; transition: background 140ms var(--ease), color 140ms var(--ease);
}
.row-act:hover { background: var(--primary-soft); color: var(--primary); }
.row-act svg { width: 15px; height: 15px; }

/* pagination footer */
.pager { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-top: 1px solid var(--border); }
.pager-info { font-size: 13px; color: var(--text-2); }
.pager-btns { display: flex; gap: 6px; align-items: center; }
.pg {
	min-width: 34px; height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border);
	background: var(--card); color: var(--text-2); font-family: inherit; font-size: 13.5px; cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center; transition: all 140ms var(--ease);
}
.pg:hover { border-color: #C7D6EF; color: var(--text); }
.pg.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pg:disabled { opacity: .4; cursor: default; }

/* signed progress mini */
.signed { display: inline-flex; align-items: center; gap: 8px; }
.signed-track { width: 54px; height: 6px; background: #EEF1F5; border-radius: 9999px; overflow: hidden; }
.signed-fill { height: 100%; background: var(--primary); border-radius: 9999px; }
.signed-txt { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* empty state */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 60px 24px; }
.empty-ico { width: 56px; height: 56px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.empty-ico svg { width: 28px; height: 28px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.empty-state p { font-size: 14px; color: var(--text-2); max-width: 360px; line-height: 1.55; }

/* ==================== DETAIL CARD (просмотр наряда) ==================== */
.detail-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 1080px) { .detail-grid { grid-template-columns: 1fr; } }
.field-row { display: grid; grid-template-columns: 190px 1fr; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.field-row:last-child { border-bottom: none; }
.field-label { font-size: 13px; color: var(--text-2); }
.field-value { font-size: 14px; color: var(--text); font-weight: 500; }
.field-value.mono { font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--text-2); background: var(--bg); border: 1px solid var(--border); border-radius: 7px; padding: 5px 10px; }

/* status timeline (детальная карточка) */
.tl { position: relative; padding-left: 24px; }
.tl::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: -24px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--card); border: 2px solid var(--primary); }
.tl-item.tl-done::before { background: var(--primary); }
.tl-when { font-size: 11.5px; color: #9AA4B2; font-variant-numeric: tabular-nums; }
.tl-status { font-size: 13.5px; font-weight: 500; color: var(--text); margin: 1px 0; }
.tl-who { font-size: 12px; color: var(--text-2); }

/* risk-zones cards */
.zone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.zone { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; border-left: 3px solid var(--primary); transition: box-shadow 200ms var(--ease), transform 140ms var(--ease); }
.zone:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.zone-name { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 10px; }
.zone-stats { display: flex; gap: 18px; }
.zone-stat .zs-val { font-size: 20px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.zone-stat .zs-lbl { font-size: 11.5px; color: var(--text-2); }

/* ==================== CRUD: modal + form + errors ==================== */
.row-act-danger:hover { background: rgba(239,68,68,0.10); color: var(--danger); }

.modal-overlay {
	position: fixed; inset: 0; background: rgba(15,23,42,0.32);
	display: flex; align-items: flex-start; justify-content: center;
	padding: 60px 20px; z-index: 100; backdrop-filter: blur(2px);
	animation: fadeIn 140ms var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
	background: var(--card); border-radius: 14px; width: 100%; max-width: 480px;
	box-shadow: 0 20px 60px rgba(15,23,42,0.24); overflow: hidden;
	animation: modalIn 180ms var(--ease);
}
@keyframes modalIn { from { transform: translateY(-12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 16px; font-weight: 600; color: var(--text); }
.modal-close { width: 32px; height: 32px; border: none; background: transparent; color: var(--text-2); border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 140ms var(--ease); }
.modal-close:hover { background: var(--hover); color: var(--text); }
.modal-body { padding: 22px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); background: #FCFDFE; }
/* .modal-actions — подвал модалки в ручной вёрстке views.templ (в crud.templ тот же
   узел называется .modal-foot). Класс существовал в разметке 25 модалок, но НЕ имел
   ни одного правила: кнопки прилипали к левому краю без отступов и без отбивки от
   тела формы. Правила совпадают с .modal-foot — один и тот же узел обязан выглядеть
   одинаково, каким бы из двух имён его ни назвали. Инлайновые style= на отдельных
   .modal-actions (выравнивание влево у фильтров) продолжают перекрывать это правило. */
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); background: #FCFDFE; }

/* --- ПЕРЕРАСХОД --- */
.modal-wide { max-width: 780px; }
.overrun-block { margin-top: 8px; }
.row-overrun { background: rgba(239,68,68,0.055); }
.row-saving  { background: rgba(34,197,94,0.06); }
.delta-overrun { color: #DC2626; font-weight: 600; }
.delta-saving  { color: #15803D; font-weight: 600; }
.overrun-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.overrun-kpi { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.overrun-kpi-lbl { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.overrun-kpi-val { font-size: 18px; font-weight: 600; color: var(--text); }

.form-field { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.form-input {
	width: 100%; font-family: inherit; font-size: 14px; color: var(--text);
	padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
	background: var(--card); outline: none; transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.form-input:focus { border-color: var(--primary); box-shadow: var(--ring); }
textarea.form-input { resize: vertical; }
.form-note { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--text-2); background: var(--bg); border-radius: var(--radius-sm); padding: 10px 12px; line-height: 1.5; }
.form-note svg { flex-shrink: 0; margin-top: 1px; color: var(--primary); }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); margin-bottom: 6px; cursor: pointer; }
.form-check input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.field-hint { display: block; font-size: 12px; margin-top: 5px; line-height: 1.4; }

/* Панель серверных фильтров реестра (Волна 2). Обычная GET-форма: значения уходят в URL
   и дальше в Go — фильтрация на сервере, не отсев загруженной страницы в браузере. */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.filter-fld { display: flex; flex-direction: column; gap: 4px; }
.filter-fld > span { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); }
.filter-fld .form-input { width: auto; min-width: 130px; padding: 7px 10px; font-size: 13px; }
.filter-acts { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.filter-count { font-size: 13px; color: var(--text-2); }

.btn-ghost2 {
	background: var(--card); border: 1px solid var(--border); color: var(--text-2);
	padding: 10px 16px; border-radius: var(--radius-sm); font-family: inherit; font-size: 14px; font-weight: 500;
	cursor: pointer; transition: all 150ms var(--ease);
}
.btn-ghost2:hover { color: var(--text); border-color: #C7D6EF; }

.form-err-banner {
	display: flex; gap: 9px; align-items: flex-start;
	background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.22);
	color: #B91C1C; border-radius: var(--radius-sm); padding: 11px 13px;
	font-size: 13px; line-height: 1.45; margin-bottom: 16px;
}
.form-err-banner svg { flex-shrink: 0; margin-top: 1px; }

/* Баннер «это демонстрационные данные» (Волна 3 пакет B, экран документов 1С).
   Повторяет форму .form-err-banner, но янтарным: это ПРЕДУПРЕЖДЕНИЕ, а не ошибка —
   экран работает, просто за ним пока заглушка вместо реального обмена. Заметность
   намеренная: признак мока не должен теряться на фоне таблицы. */
.banner {
	display: flex; gap: 9px; align-items: flex-start;
	border-radius: var(--radius-sm); padding: 11px 13px;
	font-size: 13px; line-height: 1.45; margin-bottom: 16px;
}
.banner-amber {
	background: rgba(245,158,11,0.10); border: 1px solid rgba(245,158,11,0.30);
	color: #B45309;
}

/* ===== Инфо-экран «Защита целостности» (конвейер сверху вниз) ===== */
.intg-pipe { display: flex; flex-direction: column; align-items: stretch; gap: 0; max-width: 860px; }
.intg-block {
	background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
	box-shadow: var(--shadow); overflow: hidden;
}
.intg-block-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.intg-num {
	flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
	background: var(--primary); color: #fff; font-weight: 700; font-size: 14px;
	display: flex; align-items: center; justify-content: center; margin-top: 2px;
}
.intg-block-ic { flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.intg-block-ic svg { width: 22px; height: 22px; }
.intg-block-titles { flex: 1; min-width: 0; }
.intg-block-title { font-size: 16px; font-weight: 650; color: var(--text); margin-bottom: 4px; }
.intg-block-desc { font-size: 13px; line-height: 1.55; color: var(--text-2); }
.intg-block-head .badge { flex-shrink: 0; margin-top: 2px; }
.intg-block-visual { padding: 22px 24px; }

/* стрелка-соединитель между блоками */
.intg-arrow-down { display: flex; justify-content: center; color: #C3CBD6; padding: 4px 0; }
.intg-arrow-down svg { width: 22px; height: 22px; }

/* Блок 1 — документ → хеш */
.intg-flow { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.intg-flow > svg { width: 20px; height: 20px; color: #B0BAC7; flex-shrink: 0; }
.intg-node {
	display: flex; align-items: center; gap: 10px; padding: 12px 16px;
	background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
	font-size: 13px; font-weight: 550; color: var(--text);
}
.intg-node svg { width: 22px; height: 22px; color: var(--primary); }
.intg-node-muted svg { color: #9AA6B4; }
.intg-hashbox {
	flex: 1; min-width: 220px; padding: 12px 16px;
	background: rgba(34,197,94,0.06); border: 1px solid rgba(34,197,94,0.22); border-radius: var(--radius-sm);
}
.intg-hash-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #15803D; margin-bottom: 5px; }
.intg-hash { font-size: 12.5px; color: #166534; word-break: break-all; line-height: 1.4; }

/* Блок 2 — WORM-цепь */
.intg-chain { display: flex; align-items: center; gap: 0; flex-wrap: wrap; }
.intg-link {
	display: flex; flex-direction: column; gap: 4px; padding: 12px 14px;
	background: rgba(34,197,94,0.07); border: 1.5px solid rgba(34,197,94,0.30); border-radius: var(--radius-sm);
	min-width: 96px;
}
.intg-link-seq { font-size: 12px; font-weight: 700; color: #15803D; }
.intg-link-hash { font-size: 12px; color: #166534; }
.intg-link-bad { background: rgba(245,158,11,0.10); border-color: rgba(245,158,11,0.40); }
.intg-link-bad .intg-link-seq, .intg-link-bad .intg-link-hash { color: #B45309; }
.intg-link-broken { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.38); }
.intg-link-broken .intg-link-seq, .intg-link-broken .intg-link-hash { color: #DC2626; }
.intg-conn { display: flex; align-items: center; justify-content: center; color: #22C55E; width: 34px; }
.intg-conn svg { width: 20px; height: 20px; }
.intg-conn-broken { color: var(--danger); }
.intg-chain-broken { margin-top: 16px; }
.intg-chain-caption { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 550; margin-top: 8px; }
.intg-chain-caption svg { width: 16px; height: 16px; flex-shrink: 0; }
.intg-ok { color: #15803D; }
.intg-bad { color: #DC2626; }
.intg-honest {
	display: flex; gap: 11px; align-items: flex-start; margin-top: 20px;
	background: var(--primary-soft); border: 1px solid rgba(30,64,175,0.18); border-radius: var(--radius-sm);
	padding: 14px 16px; font-size: 13px; line-height: 1.55; color: var(--text);
}
.intg-honest svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--primary); margin-top: 1px; }
.intg-honest strong { color: var(--primary); }

/* Блок 3 — TSA */
.intg-tsa {
	display: flex; align-items: center; gap: 12px; padding: 12px 16px;
	background: rgba(245,158,11,0.08); border: 1px dashed rgba(245,158,11,0.45); border-radius: var(--radius-sm);
}
.intg-tsa svg { width: 26px; height: 26px; color: #B45309; flex-shrink: 0; }
.intg-tsa-title { font-size: 13px; font-weight: 600; color: #B45309; }
.intg-tsa-sub { font-size: 11.5px; color: #9A6B12; margin-top: 2px; }
.intg-plan {
	display: flex; gap: 10px; align-items: flex-start; margin-top: 16px;
	background: rgba(245,158,11,0.07); border: 1px solid rgba(245,158,11,0.22); border-radius: var(--radius-sm);
	padding: 13px 15px; font-size: 12.5px; line-height: 1.55; color: #92600F;
}
.intg-plan svg { width: 17px; height: 17px; flex-shrink: 0; color: #B45309; margin-top: 1px; }

/* Итоговая строка */
.intg-summary {
	display: flex; gap: 16px; align-items: flex-start; max-width: 860px; margin-top: 22px;
	background: linear-gradient(180deg, rgba(30,64,175,0.06), rgba(30,64,175,0.02));
	border: 1px solid rgba(30,64,175,0.16); border-radius: var(--radius); padding: 22px 24px;
}
.intg-summary-icon { flex-shrink: 0; width: 44px; height: 44px; border-radius: 11px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; }
.intg-summary-icon svg { width: 24px; height: 24px; }
.intg-summary-title { font-size: 16px; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.intg-summary-text { font-size: 13.5px; line-height: 1.6; color: var(--text); }
.intg-summary-text strong { color: var(--text); font-weight: 650; }

/* ===== Verify-баннеры (живая проверка целостности, HTMX partial) ===== */
.vfy {
	display: flex; gap: 13px; align-items: flex-start;
	border-radius: var(--radius); padding: 15px 18px; margin: 14px 0;
	border: 1px solid; box-shadow: var(--shadow);
	animation: vfy-in 200ms var(--ease);
}
@keyframes vfy-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.vfy svg { width: 22px; height: 22px; flex-shrink: 0; margin-top: 1px; }
.vfy-title { font-size: 14.5px; font-weight: 650; margin-bottom: 3px; }
.vfy-sub { font-size: 13px; line-height: 1.5; }
.vfy-sub code { font-size: 12px; }
.vfy-ok      { background: rgba(34,197,94,0.08);  border-color: rgba(34,197,94,0.30);  color: #15803D; }
.vfy-ok .vfy-sub, .vfy-ok .vfy-title { color: #166534; }
.vfy-bad     { background: rgba(239,68,68,0.08);  border-color: rgba(239,68,68,0.32);  color: #DC2626; }
.vfy-bad .vfy-sub, .vfy-bad .vfy-title { color: #B91C1C; }
.vfy-warn    { background: rgba(245,158,11,0.09); border-color: rgba(245,158,11,0.34); color: #B45309; }
.vfy-warn .vfy-sub, .vfy-warn .vfy-title { color: #92600F; }
.vfy-neutral { background: var(--bg); border-color: var(--border); color: var(--text-2); }
.vfy-neutral .vfy-title { color: var(--text); }
.vfy-err     { background: rgba(107,114,128,0.07); border-color: rgba(107,114,128,0.24); color: #4B5563; }
.vfy-err .vfy-title { color: #374151; }
/* HTMX-индикатор загрузки: пока идёт запрос — приглушаем контейнер */
.htmx-request.vfy, .htmx-request .vfy { opacity: 0.55; }

/* живая демо-кнопка на инфо-экране */
.intg-live { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 20px; }
.intg-live-hint { font-size: 12.5px; color: var(--text-2); line-height: 1.5; max-width: 420px; }

/* переключатель языка RU|KZ в топбаре */
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.lang-opt { padding: 5px 11px; font-size: 12px; font-weight: 600; color: var(--text-2); text-decoration: none; background: var(--card); transition: background .12s, color .12s; }
.lang-opt + .lang-opt { border-left: 1px solid var(--border); }
.lang-opt:hover { background: var(--hover); color: var(--text); }
.lang-opt.on { background: var(--primary); color: #fff; }

/* честная пометка «демо-данные» (урок ОСК: мок не выдаём за реальное) */
.demo-badge { display: inline-flex; align-items: center; padding: 2px 9px; margin-left: 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; color: #B45309; background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.32); border-radius: 999px; cursor: help; }

/* ==================== ПОЛЬЗОВАТЕЛЬ В ШАПКЕ (per-user, Э2) ==================== */
.user-menu { display: inline-flex; align-items: center; gap: 10px; }
.user-meta { line-height: 1.2; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-role { font-size: 11.5px; color: var(--text-2); }
.user-logout { font-size: 12px; font-weight: 600; color: var(--text-2); text-decoration: none; padding: 5px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); transition: background .12s, color .12s; }
.user-logout:hover { background: var(--hover); color: var(--text); }

/* ==================== ВХОД (/login, Emilus-стиль, per-user Э2) ==================== */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #EEF2FB 0%, #F5F7FA 55%, #FDF6EC 100%); padding: 24px; }
.login-lang { position: fixed; top: 20px; right: 24px; }
.login-wrap { width: 100%; max-width: 400px; }
.login-card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 36px 32px 32px; box-shadow: 0 18px 48px rgba(30,64,175,0.10); }
.login-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 26px; }
.login-logo { display: block; height: 54px; width: auto; max-width: 100%; }
.login-mark { width: 46px; height: 46px; border-radius: 12px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px; letter-spacing: 0.02em; }
.login-brand-name { font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.15; }
.login-brand-org { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }
.login-title { font-size: 21px; font-weight: 600; color: var(--text); margin-bottom: 4px; letter-spacing: -0.01em; }
.login-sub { font-size: 13.5px; color: var(--text-2); margin-bottom: 22px; }
.login-error { display: flex; align-items: center; gap: 8px; padding: 10px 13px; margin-bottom: 18px; font-size: 13px; font-weight: 500; color: #B42318; background: rgba(240,68,56,0.08); border: 1px solid rgba(240,68,56,0.28); border-radius: 10px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.login-field input { width: 100%; box-sizing: border-box; padding: 11px 13px; font-family: inherit; font-size: 14px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; outline: none; transition: border-color .12s, box-shadow .12s, background .12s; }
.login-field input:focus { border-color: var(--primary); background: var(--card); box-shadow: var(--ring); }
.login-submit { margin-top: 6px; padding: 12px; font-family: inherit; font-size: 14.5px; font-weight: 600; color: #fff; background: var(--primary); border: none; border-radius: 10px; cursor: pointer; transition: background .12s; }
.login-submit:hover { background: var(--primary-hover); }
.login-foot { text-align: center; margin-top: 20px; font-size: 12px; color: var(--text-2); }

/* --- RBAC-матрица --- */
.rbac-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.rbac-chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); color: var(--text-2); }
.rbac-chip.rbac-allow { color: #15803D; }
.rbac-chip.rbac-deny { color: #DC2626; }
.rbac-chip.rbac-ovr { color: var(--primary); }
.rbac-chip.rbac-sens { color: #B45309; }
table.rbac-matrix { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 13px; }
table.rbac-matrix th, table.rbac-matrix td { border-bottom: 1px solid var(--border); }
.rbac-rowhead-h { position: sticky; left: 0; z-index: 6; background: var(--card); text-align: left; padding: 10px 14px; min-width: 300px; }
.rbac-colhead { padding: 8px 10px; text-align: center; vertical-align: bottom; min-width: 96px; background: var(--card); position: sticky; top: 0; z-index: 5; }
.rbac-col-label { font-weight: 600; font-size: 12.5px; color: var(--text); line-height: 1.25; }
.rbac-col-key { font-size: 10.5px; color: var(--text-2); margin-top: 2px; }
.rbac-rename { margin-top: 4px; border: none; background: transparent; cursor: pointer; color: var(--text-2); font-size: 12px; }
.rbac-rename:hover { color: var(--primary); }
.rbac-modrow .rbac-modhead { position: sticky; left: 0; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 12px; letter-spacing: .03em; text-transform: uppercase; padding: 7px 14px; }
.rbac-rowhead { position: sticky; left: 0; z-index: 4; background: var(--card); text-align: left; padding: 9px 14px; min-width: 300px; }
.rbac-row:hover .rbac-rowhead, .rbac-row:hover .rbac-cell { background: #FBFCFE; }
.rbac-act-label { font-weight: 500; color: var(--text); }
.rbac-act-meta { font-size: 10.5px; color: var(--text-2); margin-top: 2px; }
.rbac-row-sensitive .rbac-rowhead { border-left: 3px solid #F59E0B; background: rgba(245,158,11,0.05); }
.rbac-row-sensitive:hover .rbac-rowhead { background: rgba(245,158,11,0.09); }
.rbac-sens-mark { color: #B45309; margin-right: 4px; }
.rbac-cell { text-align: center; padding: 6px 8px; background: var(--card); }
.rbac-cell-mark { font-size: 14px; font-weight: 700; line-height: 1; }
.rbac-cell-on .rbac-cell-mark { color: #16A34A; }
.rbac-cell-off .rbac-cell-mark { color: #DC2626; opacity: .55; }
.rbac-ovr-dot { color: var(--primary); font-size: 9px; margin-left: 2px; vertical-align: super; }
.rbac-cell-ovr { box-shadow: inset 0 0 0 2px var(--primary-soft); }
.rbac-select { margin-top: 5px; font-family: inherit; font-size: 11px; padding: 2px 4px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg); color: var(--text-2); cursor: pointer; max-width: 92px; }
.rbac-select:focus { border-color: var(--primary); outline: none; }

/* КЛИКАБЕЛЬНАЯ ячейка матрицы (Волна 5, эталон ОСК click-cycle) */
.rbac-cell-btn { cursor: pointer; user-select: none; transition: background 120ms var(--ease); border-left: 1px solid var(--border); }
.rbac-cell.st-allow { background: rgba(34,197,94,.06); }
.rbac-cell.st-deny { background: rgba(239,68,68,.05); }
.rbac-cell-btn:hover { background: var(--primary-soft); }
.rbac-cell-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.rbac-box {
	display: inline-flex; align-items: center; justify-content: center;
	width: 24px; height: 24px; border-radius: 6px; margin: 0 auto;
	font-size: 13px; font-weight: 700; line-height: 1;
}
.rbac-box.allow { background: rgba(34,197,94,.14); color: #16A34A; }
.rbac-box.deny { background: rgba(239,68,68,.12); color: #DC2626; }
.rbac-box.inherit { background: var(--bg); color: #98A2B3; border: 1px dashed var(--border); }
.rbac-box.inherit-allow { background: transparent; color: #16A34A; border: 1px dashed #16A34A; opacity: .55; }
.rbac-box.inherit-deny { background: transparent; color: #DC2626; border: 1px dashed #DC2626; opacity: .5; }

/* Справочники должностей/сотрудников: архивная строка приглушена */
tr.row-archived td { opacity: .5; }

/* Редактор матрицы «должность × разряд × действие» */
.posmatrix-controls { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; }
.posmatrix-controls .form-field { min-width: 240px; margin: 0; }
.posmatrix-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.rbac-colhead.posmatrix-group { border-left: 1px solid var(--border); font-weight: 700; color: var(--text); background: var(--bg); position: static; }
table.posmatrix .rbac-colhead { min-width: 74px; font-size: 11px; }
.posmatrix-eff { font-size: 10px; margin-left: 4px; vertical-align: super; }
.posmatrix-eff-on { color: #16A34A; }
.posmatrix-eff-off { color: var(--text-2); opacity: .6; }

/* Ёмкости сырья (Ур.0) */
.badge-warn { background: rgba(245,158,11,0.16); color: #B45309; }
.fill-bar { position: relative; width: 120px; height: 16px; background: #EEF1F5; border-radius: 8px; overflow: hidden; }
.fill-bar-in { position: absolute; left: 0; top: 0; bottom: 0; background: var(--primary); opacity: .85; }
.fill-bar-lbl { position: relative; z-index: 1; font-size: 10px; line-height: 16px; padding-left: 8px; color: var(--text-2); font-weight: 600; }
.stat-hero { padding: 14px 16px; background: var(--primary-soft, #EEF3FF); border-radius: 12px; }
.stat-hero-val { font-size: 30px; font-weight: 700; color: var(--text); letter-spacing: -.5px; }
.stat-hero-lbl { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.stat-hero-sub { font-size: 12px; color: var(--text-2); margin-top: 6px; display: flex; align-items: center; gap: 8px; }

/* ===== ДИРЕКТОРСКИЙ ДАШБОРД: секции, графики ApexCharts, severity-тон ===== */
/* Секция самодостаточна: добавлено, не переписано. */
.section-head {
	font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
	color: var(--text-2); margin: 26px 0 12px; padding-bottom: 6px;
	border-bottom: 1px solid var(--border);
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.section-head:first-of-type { margin-top: 8px; }

/* период-контрол трендов (?days=7/30/90) */
.period-ctl { display: inline-flex; gap: 4px; text-transform: none; letter-spacing: 0; }
.period-link {
	font-size: 12px; font-weight: 600; color: var(--text-2); text-decoration: none;
	padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border);
	transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.period-link:hover { background: var(--primary-soft); }
.period-link.on { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Графики ApexCharts (dashboard_charts.templ) */
.chart-card {
	background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
	box-shadow: var(--shadow); padding: 18px 18px 12px; transition: box-shadow 0.2s var(--ease);
}
.chart-card:hover { box-shadow: var(--shadow-md); }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.chart-title { font-size: 15px; font-weight: 600; color: var(--text); }
.chart-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.chart-body { min-height: 280px; }
.chart-body .apexcharts-legend { padding-top: 4px; }
.chart-donut .apexcharts-pie-area, .chart-bar .apexcharts-bar-area { cursor: pointer; }
.chart-empty { min-height: 120px; display: flex; align-items: center; justify-content: center;
	color: var(--text-2); font-size: 13px; text-align: center; padding: 20px; }

/* severity-тон бара mini-метрики (почин metricCard) */
.bar-amber { background: #F59E0B; }
.bar-red   { background: #DC2626; }
.bar-green { background: #22C55E; }
.val-red   { color: #DC2626; font-weight: 600; }
.val-amber { color: #B45309; font-weight: 600; }

/* строка таблицы / значение — тон тревоги */
tr.row-alert { background: rgba(220,38,38,0.05); }
tr.row-alert:hover { background: rgba(220,38,38,0.09); }

/* KPI-плитки секций (наряды, списания) */
.kpi-tiles { display: flex; flex-wrap: wrap; gap: 12px; }
.kpi-tile {
	flex: 1 1 100px; min-width: 100px; text-decoration: none;
	background: var(--bg, #F7F8FA); border: 1px solid var(--border); border-radius: 10px;
	padding: 14px 16px; transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
a.kpi-tile:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-tile-val { font-size: 26px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; line-height: 1.1; }
.kpi-tile-lbl { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.kpi-tile.tile-red   { border-color: rgba(220,38,38,0.35); background: rgba(220,38,38,0.06); }
.kpi-tile.tile-red   .kpi-tile-val { color: #DC2626; }
.kpi-tile.tile-amber { border-color: rgba(245,158,11,0.35); background: rgba(245,158,11,0.07); }
.kpi-tile.tile-amber .kpi-tile-val { color: #B45309; }

/* KPI-карточки шапки — акцент по тону */
.stat-card.stat-red    { border-color: rgba(220,38,38,0.30); }
.stat-card.stat-amber  { border-color: rgba(245,158,11,0.30); }
.stat-card.stat-indigo { border-color: rgba(99,102,241,0.30); }

/* кликабельная строка-бар (отгрузки/снабжение → drill) */
.bar-row-link { text-decoration: none; color: inherit; border-radius: 8px; padding: 7px 8px; margin: 0 -8px; transition: background 0.15s var(--ease); }
.bar-row-link:hover { background: var(--primary-soft); }

@media (max-width: 720px) { .kpi-tiles { flex-direction: column; } }

/* ===== БИРДС-АЙ обзор прав по должностям (read-only, две вкладки + печать) ===== */
/* Переключатель вкладок — чистый CSS: скрытые radio + label; :checked показывает панель. */
.pot-radio { position: absolute; opacity: 0; pointer-events: none; }
.posoverview-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 8px; }
.pot-tabs { display: inline-flex; gap: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.pot-tab { cursor: pointer; padding: 7px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); user-select: none; transition: background 120ms var(--ease), color 120ms var(--ease); }
#pot-table:checked ~ .posoverview-bar .pot-tab[for="pot-table"],
#pot-cards:checked ~ .posoverview-bar .pot-tab[for="pot-cards"] { background: var(--card); color: var(--primary); box-shadow: 0 1px 2px rgba(16,24,40,.06); }
.pot-print { display: inline-flex; align-items: center; gap: 7px; }
.pot-print .ico { width: 16px; height: 16px; flex-shrink: 0; }
.pot-note { margin: 4px 0 6px; }
.pot-legend { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 14px; font-size: 12px; color: var(--text-2); }
.pot-chip { display: inline-flex; align-items: center; gap: 6px; }
.pot-chip-exc { color: #B45309; }
.pot-mark { font-weight: 700; line-height: 1; }
.pot-mark.st-allow { color: #16A34A; }
.pot-mark.st-deny { color: #DC2626; }
.pot-mark.st-inherit { color: #98A2B3; }
/* панели вкладок: показываем активную */
.pot-panel { display: none; }
#pot-table:checked ~ .pot-panel-table { display: block; }
#pot-cards:checked ~ .pot-panel-cards { display: block; }

/* таблица обзора */
table.pot-table { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 12px; }
table.pot-table th, table.pot-table td { border-bottom: 1px solid var(--border); }
.pot-corner { min-width: 220px; }
.pot-grouphead { border-left: 1px solid var(--border); font-weight: 700; color: var(--text); background: var(--bg); position: static; font-size: 11px; padding: 6px 8px; }
.pot-colhead { min-width: 70px; font-size: 10px; }
.pot-poscell { min-width: 220px; }
.pot-posname { font-weight: 600; color: var(--text); }
.pot-posrole { font-size: 11px; color: var(--text-2); margin-top: 1px; }
.pot-blockhead { position: sticky; left: 0; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; padding: 6px 14px; }
.pot-cell { text-align: center; padding: 5px 6px; border-left: 1px solid var(--border); }
.pot-cell .pot-mark { font-size: 13px; }
.pot-cell.src-allow { background: rgba(34,197,94,.10); }
.pot-cell.src-deny { background: rgba(239,68,68,.09); }
.pot-cell.src-inherit { background: var(--card); }
.pot-cell.pot-eff-off.src-inherit .pot-mark { opacity: .5; }
.pot-exc { color: #B45309; font-weight: 700; margin-left: 2px; }
.pot-row:hover .pot-poscell, .pot-row:hover .pot-cell { background: #FBFCFE; }

/* карточки должностей */
.pot-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.pot-card { border: 1px solid var(--border); border-radius: 12px; background: var(--card); overflow: hidden; }
.pot-card-head { padding: 12px 14px; background: var(--bg); border-bottom: 1px solid var(--border); }
.pot-card-name { font-weight: 700; color: var(--text); }
.pot-card-role { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.pot-card-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.pot-card-col { padding: 12px 14px; }
.pot-card-can { border-right: 1px solid var(--border); }
.pot-card-coltitle { font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.pot-card-can .pot-card-coltitle { color: #16A34A; }
.pot-card-cant .pot-card-coltitle { color: #DC2626; }
.pot-card-grp { margin-bottom: 8px; }
.pot-card-grpname { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin-bottom: 2px; }
.pot-card-list { margin: 0; padding-left: 16px; font-size: 12px; color: var(--text); }
.pot-card-list li { margin: 1px 0; }
@media (max-width: 620px) { .pot-card-body { grid-template-columns: 1fr; } .pot-card-can { border-right: none; border-bottom: 1px solid var(--border); } }

/* ПЕЧАТЬ / PDF: скрыть оболочку, развернуть ОБЕ вкладки, таблица альбомная, карточки — со след. страницы */
@media print {
	@page { size: landscape; margin: 10mm; }
	.sidebar, .sidebar-scrim, .topbar, .contour-tabs, .page-sub, .posoverview-bar, .pot-legend { display: none !important; }
	.main { margin: 0 !important; }
	.content { padding: 0 !important; }
	.page-head h1 { font-size: 16px; }
	/* обе панели видны при печати, невзирая на выбранную вкладку */
	.pot-panel { display: block !important; }
	.pot-panel-cards { page-break-before: always; break-before: page; }
	.pot-table-wrap { overflow: visible !important; }
	table.pot-table { font-size: 8px; }
	.pot-colhead { min-width: 0; }
	.pot-poscell, .pot-corner { min-width: 0; }
	.pot-cell { padding: 2px 3px; }
	.pot-card { break-inside: avoid; }
	.pot-cards-grid { grid-template-columns: 1fr 1fr; }
	/* печатаем фоновые цвета ячеек */
	* { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}

/* ── Страница «Приложения» (/apps) ───────────────────────────────────────── */
/* Две плитки в ряд, на телефоне — в столбик: страницу открывают и с телефона,
   чтобы тут же скачать APK. */
.apps-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 16px;
	margin: 16px 0;
}
.app-card { display: flex; flex-direction: column; padding: 20px; }
.app-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.app-card-head h3 { margin: 0; font-size: 17px; }
.app-card-body { color: #475569; line-height: 1.55; margin: 0 0 12px; flex: 1; }
.app-card-meta {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 13px; color: #64748b; margin-bottom: 12px;
}
.app-card-btn { align-self: flex-start; text-decoration: none; }
/* Недоступная платформа: НЕ серая кнопка (её жмут и злятся), а текст с причиной. */
.app-card-off {
	padding: 10px 12px; border-radius: 8px;
	background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
	font-size: 14px; line-height: 1.5;
}

/* ── Сторно: пометки в ленте движений и реквизиты в форме ────────────────── */
/* Бейдж «Исправление» — на строке, которая ОТМЕНЯЕТ другую. */
.badge-rev {
	background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe;
	margin-left: 6px;
}
/* Бейдж «Исправлено» — на строке, которую УЖЕ отменили. Приглушённый: запись остаётся
   в журнале навсегда, но на остаток больше не влияет. */
.badge-reversed {
	background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0;
	margin-left: 6px;
}
/* Реквизиты отменяемого движения в модалке подтверждения. Класс был пуст: разметка его
   использовала, а правил не существовало. */
.detail-field { margin-bottom: 12px; }
.detail-label { font-size: 12px; color: #64748b; margin-bottom: 3px; }
.detail-value { font-size: 15px; color: #0f172a; font-weight: 600; }
