/* ==========================================================================
   isp_web — ТЁМНАЯ тема оформления (вариант «Тёмная тема» из макетов).
   Светлая версия: css/theme-light.css (переключение: 'ISP_THEME' => 'light' в cfg.local.php)
   Подключается ПОСЛЕДНЕЙ в views/main_tpl.php и перекрашивает существующие
   классы (table.t, table.frm, table.frm2, a.link_static, .ui-dialog …),
   поэтому JS-код, генерирующий разметку, менять не нужно.
   Отключить тему = убрать <link> на этот файл.
   ========================================================================== */

:root {
	color-scheme: dark;

	--bg:            #111318;
	--surface:       #1a1d24;
	--surface-2:     #20242c;
	--surface-input: #111318;
	--border:        #2a2f3a;
	--border-strong: #3a404c;
	--divider:       #262a33;
	--row-hover:     #222733;
	--text:          #e6e8ec;
	--text-muted:    #9aa3b2;
	--text-faint:    #737b8a;

	--accent:        #f5a524;
	--accent-hover:  #ffb84a;
	--accent-soft:   #2b2412;
	--accent-text:   #f8c56a;
	--on-accent:     #1a1300;

	--danger:        #ff8a80;
	--danger-soft:   #3d1c1c;
	--success:       #7ee2a8;
	--success-soft:  #12372a;
	--warning-soft:  #3a2f0f;

	--sidebar-bg:     #0b0d11;
	--sidebar-text:   #c3c9d4;
	--sidebar-head:   #8b93a1;
	--sidebar-hover:  #181b22;
	--sidebar-active: #262014;

	--radius:    6px;
	--radius-lg: 10px;
	--shadow:    0 1px 2px rgba(0,0,0,.35);
	--shadow-lg: 0 16px 40px rgba(0,0,0,.55);

	--font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
	--mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

/* ---------- База ---------- */
html { height: 100%; }
body {
	margin: 0;
	min-height: 100%;
	background: var(--bg);
	color: var(--text);
	font: 13px/1.45 var(--font);
	-webkit-font-smoothing: antialiased;
}
input, select, textarea, button { font-family: inherit; font-size: 13px; }
h1, h2, h3, h4 { color: var(--text); font-weight: 600; line-height: 1.25; }
h3 { font-size: 15px; margin: 12px 0 8px; }

a, td.content a, .content a {
	color: var(--accent-text);
	text-decoration: none;
	cursor: pointer;
}
a:hover { color: #ffd88f; text-decoration: underline; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Каркас страницы ---------- */
.app {
	display: grid;
	grid-template-columns: 248px minmax(0, 1fr);
	min-height: 100vh;
	background: var(--bg);
}
.app.no-menu { grid-template-columns: minmax(0, 1fr); }

.app-sidebar {
	background: var(--sidebar-bg);
	color: var(--sidebar-text);
	position: sticky;
	top: 0;
	height: 100vh;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: #2e3440 transparent;
	display: flex;
	flex-direction: column;
}
.app-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 16px 16px 14px;
	color: #fff;
	font-weight: 600;
	font-size: 15px;
	letter-spacing: .2px;
	border-bottom: 1px solid #1d2028;
}
.app-brand-mark {
	width: 28px; height: 28px;
	border-radius: 7px;
	background: var(--accent);
	display: grid; place-items: center;
	font-size: 13px; font-weight: 700; color: var(--on-accent);
}
.app-nav { padding: 8px 8px 16px; flex: 1; }

.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
	position: sticky; top: 0; z-index: 50;
	display: flex; align-items: center; gap: 12px;
	height: 52px;
	padding: 0 24px;
	background: rgba(17,19,24,.92);
	backdrop-filter: saturate(1.4) blur(6px);
	border-bottom: 1px solid var(--border);
}
.app-title { margin: 0; font-size: 16px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-user { color: var(--text-muted); font-size: 12px; display: flex; align-items: center; gap: 8px; }
.app-user-avatar {
	width: 26px; height: 26px; border-radius: 50%;
	background: var(--accent-soft); color: var(--accent-text);
	display: grid; place-items: center; font-weight: 600; font-size: 12px;
	text-transform: uppercase;
}
.app-menu-toggle {
	display: none;
	border: 1px solid var(--border); background: var(--surface);
	border-radius: var(--radius); width: 34px; height: 32px; cursor: pointer;
	font-size: 16px; line-height: 1; color: var(--text);
}

/* Контент. Старые страницы рассчитаны на центрирование (<center>), оставляем. */
td.content, .content {
	overflow-x: auto;
	padding: 20px 24px 40px;
	text-align: center;
	vertical-align: top;
}

/* ---------- Боковое меню ---------- */
.nav-group { margin: 2px 0; }
.nav-group > summary {
	list-style: none;
	display: flex; align-items: center; justify-content: space-between;
	padding: 7px 10px;
	margin-top: 6px;
	border-radius: var(--radius);
	color: var(--sidebar-head);
	font-size: 11px; font-weight: 600;
	text-transform: uppercase; letter-spacing: .6px;
	cursor: pointer; user-select: none;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after {
	content: ""; width: 6px; height: 6px;
	border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
	transform: rotate(-45deg); transition: transform .15s;
	margin-right: 4px;
}
.nav-group[open] > summary::after { transform: rotate(45deg); }
.nav-group > summary:hover { color: #e6e8ec; background: var(--sidebar-hover); }
.nav-group.has-active > summary { color: #f2f3f5; }

.nav-items { display: flex; flex-direction: column; padding: 2px 0 4px; }
.nav-items a, .app-sidebar .nav-items a {
	display: block;
	padding: 6px 10px 6px 14px;
	border-radius: var(--radius);
	color: var(--sidebar-text);
	font-weight: 400;
	text-decoration: none;
	line-height: 1.35;
}
.nav-items a:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.nav-items a.selected {
	background: var(--sidebar-active);
	color: #fff;
	font-weight: 500;
	box-shadow: inset 2px 0 0 var(--accent);
	text-decoration: none;
}
.nav-group.no-hdr .nav-items { padding-top: 6px; }
#exit_menu_id { margin-top: 12px; padding-top: 10px; border-top: 1px solid #1d2028; }
#exit_menu_id a { color: #ff8a80; }

/* ---------- Таблицы-отчёты: table.t ---------- */
table.t {
	border-collapse: separate;
	border-spacing: 0;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface);
	box-shadow: var(--shadow);
	margin: 10px 1px;
	overflow: hidden;
	font-variant-numeric: tabular-nums;
}
table.t th {
	background: var(--surface-2);
	color: var(--text-muted);
	font-size: 12px;
	font-weight: 600;
	text-align: center;
	vertical-align: middle;
	padding: 8px 10px;
	border: 0;
	border-bottom: 1px solid var(--border);
	border-right: 1px solid var(--border);
	white-space: nowrap;
}
table.t td {
	padding: 6px 10px;
	border: 0;
	border-bottom: 1px solid var(--border);
	border-right: 1px solid var(--divider);
	vertical-align: middle;
}
table.t th:last-child, table.t td:last-child { border-right: 0; }
table.t > tbody > tr:last-child > td,
table.t > tr:last-child > td { border-bottom: 0; }
/* Подсветка строк — на <tr>, чтобы цвета статусов, которые JS ставит
   инлайном на ячейки/строки, оставались видимыми. */
table.t > tbody > tr:hover,
table.t > tr:hover { background-color: var(--row-hover); }
table.t a { color: var(--accent-text); }

/* ---------- Отчёты по заявкам (request_report.css) и склад (bal_rep.css) ----------
   Эти CSS подключаются в шаблонах разделов, то есть ПОСЛЕ theme.css,
   поэтому здесь селекторы усилены префиксом .app */
.app table.rr, .app table.wh_bal_rep, .app table.fines_tb {
	border-collapse: separate;
	border-spacing: 0;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface);
	box-shadow: var(--shadow);
	margin: 10px 1px;
	overflow: hidden;
	font-variant-numeric: tabular-nums;
}
.app table.rr > tbody > tr > th, .app table.wh_bal_rep th {
	background: var(--surface-2);
	color: var(--text-muted);
	font-size: 12px; font-weight: 600;
	padding: 8px 10px;
	border: 0;
	border-bottom: 1px solid var(--border);
	border-right: 1px solid var(--border);
}
.app table.rr > tbody > tr > td, .app table.wh_bal_rep td, .app table.fines_tb td {
	padding: 6px 10px;
	border: 0;
	border-bottom: 1px solid var(--border);
	border-right: 1px solid var(--divider);
}
.app table.rr > tbody > tr > th:last-child, .app table.rr > tbody > tr > td:last-child,
.app table.wh_bal_rep th:last-child, .app table.wh_bal_rep td:last-child { border-right: 0; }
.app table.rr > tbody > tr:hover { background-color: var(--row-hover); }
.app table.rr > tbody > tr a { color: var(--accent-text); font-weight: 600; }
.app table.rr > tbody > tr > td.but { background: var(--surface-2); }
.app table.rr > tbody > tr > td.l_info_na { background: #2a2f3a; }
/* статусы строк: смысл тот же, цвет мягче */
.app table.rr > tbody > tr.cfg      { background-color: #2f2a12; }
.app table.rr > tbody > tr.conn     { background-color: #3d1c1c; }
.app table.rr > tbody > tr.new_r    { background-color: #13283f; }
.app table.rr > tbody > tr.days_warning { background-color: #3a2f0f !important; }
.app table.rr > tbody > tr.selected { background-color: #12372a !important; }
/* кнопки комментариев: серая — нет новых, зелёная — есть новые, красная — важный */
.app table.rr input[type="button"].comm, .app table.rr a.comm {
	background: transparent; border: 1px solid var(--border); color: var(--text-faint); font-weight: 400;
	border-radius: var(--radius);
}
.app table.rr input[type="button"].comm_new, .app table.rr a.comm_new {
	background: #12372a; border: 1px solid #1f5a3a; color: #7ee2a8; font-weight: 600;
	border-radius: var(--radius);
}
.app table.rr input[type="button"].comm_imp {
	background: #3d1c1c; border: 1px solid #6b2b2b; color: var(--danger); font-weight: 600;
}
.app td.rr_group, .app td.rr_group_red, .app td.rr_pseudogroup, .app td.rr_group2 { background: var(--surface); }
.app td.rr_group_red { color: var(--danger); }
.app table.wh_bal_rep tr.total_item { background: #33281a; }
.app table.wh_bal_rep td.cat { background: #14301f; }
.app table.wh_bal_rep td.whs { background: #3a2416; }

/* ---------- Формы-таблицы: table.frm / table.frm2 ---------- */
table.frm, table.frm2 {
	border-collapse: separate;
	border-spacing: 0;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface);
	box-shadow: var(--shadow);
	margin: 10px 0;
}
table.frm2 { margin: 0; box-shadow: none; }
table.frm th, table.frm2 th {
	background: transparent;
	color: var(--text-muted);
	font-weight: 500;
	text-align: right;
	vertical-align: middle;
	padding: 7px 12px;
	border: 0;
	border-bottom: 1px solid var(--divider);
	white-space: nowrap;
}
table.frm td, table.frm2 td {
	background: transparent;
	text-align: left;
	vertical-align: middle;
	padding: 6px 12px;
	border: 0;
	border-bottom: 1px solid var(--divider);
}
table.frm tr:last-child > th, table.frm tr:last-child > td,
table.frm2 tr:last-child > th, table.frm2 tr:last-child > td { border-bottom: 0; }
/* заголовок формы: <th colspan=2> */
table.frm th[colspan], table.frm2 th[colspan] {
	text-align: left;
	color: var(--text);
	font-size: 14px;
	font-weight: 600;
	padding: 12px 14px;
	background: var(--surface-2);
	border-bottom: 1px solid var(--border);
}
table.frm th[colspan]:first-child, table.frm2 th[colspan]:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
table.frm2 > tbody > tr > td.error { background: var(--danger-soft); border-color: #6b2b2b; }
table.frm2 > tbody > tr > td.error > span.error { color: var(--danger); }
td.but { text-align: right !important; }

table.inner, table.inner td { border: 0; }

/* ---------- Поля ввода и кнопки ---------- */
input[type="text"], input[type="password"], input[type="number"], input[type="email"],
input[type="search"], input[type="tel"], input[type="date"], input[type="datetime-local"],
input:not([type]), select, textarea {
	box-sizing: border-box;
	min-height: 30px;
	padding: 4px 8px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius);
	background: var(--surface-input);
	color: var(--text);
	transition: border-color .12s, box-shadow .12s;
	vertical-align: middle;
}
textarea { min-height: 60px; line-height: 1.4; }
select[multiple] { padding: 4px; }
input:focus, select:focus, textarea:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(245,165,36,.22);
}
input:disabled, select:disabled, textarea:disabled { background: #1f232b; color: var(--text-faint); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; vertical-align: middle; }

input[type="submit"], input[type="button"], input[type="reset"], button {
	display: inline-flex; align-items: center; justify-content: center;
	min-height: 30px;
	padding: 4px 14px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius);
	background: var(--surface-2);
	color: var(--text);
	font-weight: 500;
	cursor: pointer;
	box-shadow: none;
	transition: background .12s, border-color .12s;
	vertical-align: middle;
}
input[type="submit"]:hover, input[type="button"]:hover, input[type="reset"]:hover, button:hover {
	background: #2a2f3a; border-color: #4a5160;
}
input[type="submit"] {
	background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600;
}
input[type="submit"]:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
input[type="submit"]:disabled, input[type="button"]:disabled, button:disabled { opacity: .55; cursor: default; }

/* ---------- Ссылки-действия ---------- */
a.link_static, a.link_static_b, a.form, table.t a { color: var(--accent-text) !important; }
a.link_static_b { font-weight: 600; }
a.link_static_da { color: var(--text-faint) !important; }
a.del, table.t a.del { color: var(--danger) !important; font-weight: 600; }
a.bt {
	display: inline-block;
	padding: 3px 10px;
	margin: 1px 2px !important;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
}
a.bt:hover { background: var(--accent-soft); text-decoration: none; }

/* ---------- Сообщения ---------- */
div.error, div.notice {
	margin: 10px auto;
	max-width: 900px;
	padding: 10px 14px;
	border-radius: var(--radius);
	border: 1px solid;
	text-align: left;
}
div.error  { background: var(--danger-soft);  border-color: #6b2b2b; color: #ff9b92; }
div.notice { background: var(--success-soft); border-color: #1f5a3a; color: #8ff0b8; }

/* ---------- Пагинация ---------- */
div.pages { margin: 14px 1px 8px; }
div.pages a, a.pg {
	display: inline-block; min-width: 28px;
	padding: 4px 8px; margin: 0 2px;
	border: 1px solid var(--border); border-radius: var(--radius);
	background: var(--surface);
	text-decoration: none;
}
div.pages a:hover, a.pg:hover { background: var(--accent-soft); text-decoration: none; }
div.pages > b {
	display: inline-block; min-width: 28px; padding: 4px 8px; margin: 0 2px;
	border: 1px solid var(--accent); border-radius: var(--radius);
	background: var(--accent); color: var(--on-accent); font-weight: 600;
}

/* ---------- Переписка ---------- */
div.posts { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; }
div.post  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; }

/* ---------- Вкладки в карточке абонента (views/user_menu_tpl.php) ---------- */
.user-tabs {
	display: flex; flex-wrap: wrap; gap: 2px;
	border-bottom: 1px solid var(--border);
	margin: 0 0 14px;
	text-align: left;
}
.user-tabs a {
	padding: 8px 14px;
	color: var(--text-muted) !important;
	font-weight: 500;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
	text-decoration: none;
}
.user-tabs a:hover { color: var(--text) !important; text-decoration: none; }
.user-tabs a.active { color: var(--accent-text) !important; border-bottom-color: var(--accent); }

/* ---------- Страница входа ---------- */
.auth-wrap { min-height: calc(100vh - 60px); display: grid; place-items: center; }
.auth-card {
	width: 340px; box-sizing: border-box;
	padding: 28px 28px 24px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 14px;
	box-shadow: var(--shadow-lg);
	text-align: left;
}
.auth-card h1 { font-size: 20px; margin: 14px 0 4px; }
.auth-card p.sub { margin: 0 0 20px; color: var(--text-muted); }
.auth-card label { display: block; font-weight: 500; margin: 12px 0 5px; color: var(--text-muted); font-size: 12px; }
.auth-card input[type="text"], .auth-card input[type="password"] { width: 100%; min-height: 36px; }
.auth-card input[type="submit"] { width: 100%; min-height: 38px; margin-top: 20px; font-size: 14px; }
.auth-card .app-brand-mark { width: 36px; height: 36px; font-size: 15px; border-radius: 9px; }

/* ---------- jQuery UI (переопределяем оранжевую ui-lightness) ---------- */
.ui-widget, .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: var(--font); font-size: 13px; }
.ui-widget-content { background: var(--surface); border-color: var(--border); color: var(--text); }
.ui-widget-header {
	background: var(--surface-2); border: 0; border-bottom: 1px solid var(--border);
	color: var(--text); font-weight: 600;
}
.ui-widget-overlay { background: #000; opacity: .6; filter: none; }
.ui-dialog {
	padding: 0 !important;
	border: 1px solid var(--border) !important;
	border-radius: 12px !important;
	box-shadow: var(--shadow-lg);
	overflow: hidden;
}
.ui-dialog .ui-dialog-titlebar { padding: 12px 16px; border-radius: 0; }
.ui-dialog .ui-dialog-title { font-size: 14px; }
.ui-dialog .ui-dialog-content { padding: 14px 16px; }
.ui-dialog .ui-dialog-buttonpane {
	margin: 0; padding: 10px 16px;
	background: var(--surface-2);
	border-top: 1px solid var(--border);
}
.ui-dialog .ui-dialog-buttonpane button { margin: 0 0 0 8px; }
.ui-dialog:focus, .ui-dialog-content:focus, .ui-dialog *:focus:not(input):not(select):not(textarea):not(button) { outline: none; }
.ui-dialog .ui-dialog-titlebar-close {
	border: 0 !important; background: transparent !important; border-radius: var(--radius);
	width: 24px; height: 24px; min-height: 0; top: 50%; margin-top: 0; transform: translateY(-50%); padding: 0; right: 10px; box-shadow: none;
}
.ui-dialog .ui-dialog-titlebar-close:hover { background: #2a2f3a !important; }
/* иконки jQuery UI — нейтральный тёмный набор вместо оранжевого */
.ui-widget-header .ui-icon, .ui-state-default .ui-icon, .ui-state-hover .ui-icon, .ui-state-focus .ui-icon {
	background-image: url(../lib/jquery_ui/ui-lightness/images/ui-icons_ffffff_256x240.png);
}
.ui-state-active .ui-icon { background-image: url(../lib/jquery_ui/ui-lightness/images/ui-icons_222222_256x240.png); }
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default {
	background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text); font-weight: 500;
}
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover,
.ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus {
	background: #2a2f3a; border: 1px solid #4a5160; color: var(--text);
}
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active {
	background: var(--accent); border: 1px solid var(--accent); color: var(--on-accent);
}
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: var(--on-accent); }
.ui-state-highlight, .ui-widget-content .ui-state-highlight { background: var(--warning-soft); border: 1px solid #6b5a1a; color: var(--text); }
.ui-state-error, .ui-widget-content .ui-state-error { background: var(--danger-soft); border: 1px solid #6b2b2b; color: var(--danger); }
.ui-corner-all, .ui-corner-top, .ui-corner-bottom { border-radius: var(--radius); }
.ui-tabs .ui-tabs-nav { background: transparent; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
.ui-tabs .ui-tabs-nav li { border: 0 !important; background: transparent !important; }
.ui-tabs .ui-tabs-nav li.ui-tabs-active a, .ui-tabs .ui-tabs-nav li.ui-tabs-selected a { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.ui-datepicker { padding: 6px; border-radius: var(--radius-lg) !important; box-shadow: var(--shadow-lg); }
.ui-datepicker .ui-datepicker-header { border-radius: var(--radius); }
.ui-datepicker td a.ui-state-default { text-align: center; border-radius: 4px; border-color: transparent; }
.ui-autocomplete { border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.ui-menu .ui-menu-item a.ui-state-hover, .ui-menu .ui-menu-item a.ui-state-focus { background: var(--accent-soft); border-color: transparent; }

/* ---------- select2 ---------- */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
	border-color: var(--border-strong); border-radius: var(--radius); min-height: 30px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 28px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 28px; }
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single { border-color: var(--accent); }
.select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--accent); color: var(--on-accent); }
.select2-dropdown { border-color: var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }

/* ---------- Комбобокс (combo.css) ---------- */
.cb_result_set { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.cb_li_selected { background: var(--accent-soft); }
.cb_selected { background: var(--warning-soft); }
.cb_empty { background: #20242c; color: var(--text-faint); }

/* ---------- Прочее из style.css ---------- */
.admin-search-field { border-radius: var(--radius); }
.cap-search-item { border: 1px solid var(--border); border-radius: var(--radius); }
tr.conn.selected { background-color: #13283f !important; }
.rainbow { animation: none; color: var(--danger); } /* мигающий текст утомляет — оставляем акцент цветом */

/* ---------- Приглушение «неоновых» статусных цветов ----------
   Цвета статусов ставятся инлайном в JS/PHP (например #38FF84, #FF8D64).
   Смысл цвета сохраняется, подложка становится тёмной, текст остаётся светлым. jQuery .css() пишет rgb(),
   PHP-шаблоны — hex, поэтому указаны обе формы. Удалите блок, если не нужно. */
[style*="background"][style*="#38FF84" i],
[style*="background"][style*="rgb(56, 255, 132)"],
[style*="background"][style*="#00FF40" i],
[style*="background"][style*="rgb(0, 255, 64)"],
[style*="background"][style*="#1FFF3D" i],
[style*="background"][style*="rgb(31, 255, 61)"],
[style*="background"][style*="#51FF74" i],
[style*="background"][style*="rgb(81, 255, 116)"],
[style*="background"][style*="#83FBB7" i],
[style*="background"][style*="rgb(131, 251, 183)"],
[style*="background"][style*="#89FFB2" i],
[style*="background"][style*="rgb(137, 255, 178)"],
[style*="background"][style*="#00FF00" i],
[style*="background"][style*="rgb(0, 255, 0)"],
[style*="background"][style*="#77FF7C" i],
[style*="background"][style*="rgb(119, 255, 124)"],
[style*="background"][style*="#5BFF7C" i],
[style*="background"][style*="rgb(91, 255, 124)"],
[style*="background"][style*="#92EBAF" i],
[style*="background"][style*="rgb(146, 235, 175)"] { background-color: #12372a !important; }

[style*="background"][style*="#D6FAB5" i],
[style*="background"][style*="rgb(214, 250, 181)"],
[style*="background"][style*="#DBFFDD" i],
[style*="background"][style*="rgb(219, 255, 221)"] { background-color: #14301f !important; }

[style*="background"][style*="#FF8D64" i],
[style*="background"][style*="rgb(255, 141, 100)"],
[style*="background"][style*="#FF4B4B" i],
[style*="background"][style*="rgb(255, 75, 75)"],
[style*="background"][style*="#FF7E75" i],
[style*="background"][style*="rgb(255, 126, 117)"],
[style*="background"][style*="#FF9DA2" i],
[style*="background"][style*="rgb(255, 157, 162)"],
[style*="background"][style*="#FFB5AB" i],
[style*="background"][style*="rgb(255, 181, 171)"] { background-color: #3d1c1c !important; }

[style*="background"][style*="#FFF36B" i],
[style*="background"][style*="rgb(255, 243, 107)"],
[style*="background"][style*="#F7CA6F" i],
[style*="background"][style*="rgb(247, 202, 111)"],
[style*="background"][style*="#EEDC82" i],
[style*="background"][style*="rgb(238, 220, 130)"] { background-color: #3a2f0f !important; }

[style*="background"][style*="#BAF2FA" i],
[style*="background"][style*="rgb(186, 242, 250)"],
[style*="background"][style*="#AAD4FF" i],
[style*="background"][style*="rgb(170, 212, 255)"],
[style*="background"][style*="#4AF6FF" i],
[style*="background"][style*="rgb(74, 246, 255)"] { background-color: #13283f !important; }

/* ---------- Адаптив ---------- */
@media (max-width: 1100px) {
	.app { grid-template-columns: minmax(0, 1fr); }
	.app-sidebar {
		position: fixed; left: 0; top: 0; z-index: 200;
		width: 260px; transform: translateX(-100%);
		transition: transform .2s; box-shadow: var(--shadow-lg);
	}
	.app.menu-open .app-sidebar { transform: none; }
	.app-menu-toggle { display: inline-block; }
	.app-topbar { padding: 0 14px; }
	td.content, .content { padding: 14px 12px 32px; }
}

/* ---------- Печать ---------- */
@media print {
	.app { display: block; }
	.app-sidebar, .app-topbar, th.main_menu { display: none !important; }
	body, .app { background: #fff; }
	table.t, table.frm { box-shadow: none; }
}

/* ==========================================================================
   Тёмный режим для старой разметки
   ========================================================================== */

/* Белые фоны и чёрный текст, которые JS/PHP ставят инлайном (style="…"). */
.app [style*="background-color: white" i], .app [style*="background-color:white" i],
.app [style*="background: white" i], .app [style*="background:white" i],
.app [style*="background-color: #ffffff" i], .app [style*="background-color:#ffffff" i],
.app [style*="background-color: #fff;" i], .app [style*="background-color:#fff;" i],
.app [style$="background-color: #fff" i], .app [style$="background-color:#fff" i],
.app [style*="background-color: rgb(255, 255, 255)"] { background-color: var(--surface) !important; }
.app [style*="background"][style*="#C6C6C6" i], .app [style*="background"][style*="rgb(198, 198, 198)"],
.app [style*="background"][style*="#D2D2D2" i], .app [style*="background"][style*="rgb(210, 210, 210)"],
.app [style*="background"][style*="#B0CBDD" i], .app [style*="background"][style*="rgb(176, 203, 221)"],
.app [style*="background"][style*="#AAD0D0" i], .app [style*="background"][style*="rgb(170, 208, 208)"],
.app [style*="background"][style*="#B8B8B8" i], .app [style*="background"][style*="rgb(184, 184, 184)"] { background-color: #2a2f3a !important; }
.app [style*="color: black" i], .app [style*="color:black" i],
.app [style*="color: #000" i], .app [style*="color:#000" i],
.app [style*="color: rgb(0, 0, 0)"] { color: var(--text) !important; }
.app [style*="color: blue" i], .app [style*="color:blue" i],
.app [style*="color: rgb(0, 0, 255)"] { color: var(--accent-text) !important; }
.app [style*="color: red" i], .app [style*="color:red" i],
.app [style*="color: rgb(255, 0, 0)"] { color: var(--danger) !important; }
.app [style*="color: green" i], .app [style*="color:green" i] { color: var(--success) !important; }
.app font[color] { color: inherit; }

/* Статусная подложка на ячейке — текст в ней всегда светлый. */
.app td[style*="background"], .app tr[style*="background"] { color: var(--text); }

/* Старые стили из style.css */
td.content a { color: var(--accent-text); }
table.subnet_sel th { background: #13283f; }
table.subnet_sel td { background: #12372a; }
table.subnet_sel { border-color: var(--border); }
.cap-search-item:hover { background-color: rgba(255,255,255,.06); }
.discard_move_btn { color: var(--danger) !important; }

/* request_report.css: переписка, штрафы, связки */
.app table.comment > tbody > tr > td > div.log,
.app div.posts_log, .app div.history_posts > div.log,
.app div.intable_comments > textarea { background: var(--surface-input); color: var(--text); border-color: var(--border); }
.app div.history_posts > div.hdr { background: var(--surface-2); color: var(--text); }
.app table.fines_tb > tbody > tr > td.gcell { background: #13283f; color: var(--text); }
.app table.fines_tb > tbody > tr > td.sum, .app table.fines_tb > tbody > tr > td.sum > a { color: var(--danger); }
.app table.fines_tb > tbody > tr > td.cancelled, .app table.fines_tb > tbody > tr.total { background: #3a2222; color: var(--danger); }
.app table.raol > tbody > tr > td.group { background: #13283f; }
.app table.raol > tbody > tr > td.type { background: #14301f; }
.app table.cr_pr_tb td.error { background: #3d1c1c; }
.app table.rr > tbody > tr > td.l_info_na { color: var(--text-muted); }

/* склад: items_list.css, move_rep.css */
.app div.whs_items_cont, .app div.items_search { background: var(--surface); border-color: var(--border); }
.app div.whs_items_cont .cat_li .name, .app div.whs_items_cont .item_li .name { color: var(--text); }
.app div.whs_items_cont .cat_li .code, .app div.whs_items_cont .item_li .code { color: #f0a58a; }
.app div.items_search > div > div:hover, .app .result-item.active { background: var(--row-hover); }
.app table.wh_move td.item { background: #13283f; }
.app table.wh_move td.inst { background: #14301f; }
.app table.wh_move td.hdr  { background: #1d3448; }
.app table.wh_mv_rep { border-color: var(--border); background: var(--surface); }
.app table.wh_mv_rep th { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
.app table.wh_mv_rep td { border-color: var(--border); }
.app table.wh_mv_rep tr.total_item { background: #33281a; }
.app table.wh_mv_rep td.cat { background: #14301f; }
.app table.wh_mv_rep td.mv  { background: #33281a; }
.app ul.tree_view div.fold { color: var(--accent-text); }

/* таблицы tablesorter */
.app table.tablesorter { background: var(--border); }
.app table.tablesorter thead tr th, .app table.tablesorter tfoot tr th { background-color: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
.app table.tablesorter tbody td { background: var(--surface); color: var(--text); }
.app table.tablesorter tbody tr.odd td { background: #1d2028; }
.app table.tablesorter thead tr .headerSortDown, .app table.tablesorter thead tr .headerSortUp { background-color: var(--accent-soft); color: var(--accent-text); }

/* Всплывающие календарь dynDateTime, контекстное меню и подсказки остаются
   светлыми «карточками» — они читаемы; поля внутри них возвращаем к светлым. */
.calendar input, .calendar select, .context-menu input { background: #fff; color: #000; }
#tooltip { box-shadow: var(--shadow-lg); }

/* ---------- Печать: на бумагу всегда светлая ---------- */
@media print {
	:root { color-scheme: light; }
	body, .app, .app-main, .content, table.t, table.t th, table.t td, table.frm, table.frm th, table.frm td,
	.app table.rr, .app table.rr > tbody > tr > td, .app table.rr > tbody > tr > th {
		background: #fff !important; color: #000 !important; border-color: #999 !important;
	}
	a { color: #000 !important; }
}
