/* Минимальные правки поверх Pico.css */

main.container {
	max-width: 100%;
	padding: 1rem;
}

header {
	margin-bottom: 1rem;
}

header h1 {
	margin-bottom: 0;
}

header small {
	color: var(--pico-muted-color);
}

.report-meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	flex-wrap: wrap;
	margin: 1rem 0;
	font-size: 0.9rem;
	color: var(--pico-muted-color);
}

.report-meta button {
	margin: 0;
	padding: 0.4rem 0.9rem;
	font-size: 0.85rem;
}

.filters {
	display: flex;
	gap: 0.75rem;
	align-items: center;
	flex-wrap: wrap;
	margin-bottom: 1rem;
}

.filters input[type="search"] {
	margin: 0;
	max-width: 240px;
}

.filters select {
	margin: 0;
	max-width: 200px;
}

.filters .chk {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	margin: 0;
	font-size: 0.9rem;
	cursor: pointer;
	white-space: nowrap;
}

.filters .chk input {
	margin: 0;
}

.filters button {
	margin: 0;
	padding: 0.4rem 0.9rem;
	font-size: 0.85rem;
}

/* === shadcn-style design tokens === */
:root {
	--app-bg: #fafafa;
	--surface: #ffffff;
	--surface-2: #f4f4f5;
	--border: #e4e4e7;
	--border-strong: #d4d4d8;
	--text: #18181b;
	--muted: #71717a;
	--primary: #2563eb;
	--primary-hover: #1d4ed8;
	--primary-bg: #eff6ff;
	--success: #16a34a;
	--warning: #d97706;
	--danger: #dc2626;
}
[data-theme="dark"] {
	--app-bg: #09090b;
	--surface: #18181b;
	--surface-2: #27272a;
	--border: #27272a;
	--border-strong: #3f3f46;
	--text: #fafafa;
	--muted: #a1a1aa;
	--primary: #60a5fa;
	--primary-hover: #3b82f6;
	--primary-bg: #1e3a8a40;
}
[data-theme="dark"] body { background: var(--app-bg); color: var(--text); }

html, body { margin: 0 !important; padding: 0 !important; }
body.body-anon { background: var(--app-bg); }
.auth-container { max-width: 420px; margin: 4rem auto; }

/* === Горизонтальный топбар + breadcrumbs-полоса === */
.app-shell {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	background: var(--app-bg);
}
.app-topbar {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 0.4rem 1rem;
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	flex-wrap: wrap;
	/* НЕ sticky — топбар уезжает вверх при прокрутке страницы. */
}
.brand {
	font-weight: 700;
	font-size: 1.1rem;
	letter-spacing: -0.5px;
	color: var(--text);
	text-decoration: none;
	padding-right: 0.5rem;
	border-right: 1px solid var(--border);
	margin-right: 0;
}
.brand-mark { color: var(--primary); }
.brand-rest { color: var(--muted); font-weight: 500; }

.topnav {
	display: flex;
	gap: 0.15rem;
	flex-wrap: wrap;
}
.topnav a {
	padding: 0.3rem 0.55rem;
	border-radius: 6px;
	font-size: 0.85rem;
	color: var(--text);
	text-decoration: none;
}
.topnav a:hover { background: var(--surface-2); }
.topnav a.active { background: var(--primary-bg); color: var(--primary); font-weight: 500; }

.user-pill {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.8rem;
	color: var(--muted);
}
.user-pill strong { color: var(--text); }
.btn-logout {
	background: transparent;
	border: 1px solid var(--border-strong);
	color: var(--text);
	padding: 0.2rem 0.5rem;
	border-radius: 6px;
	font-size: 0.78rem;
	cursor: pointer;
}
.btn-logout:hover { background: var(--surface-2); border-color: var(--primary); color: var(--primary); }

/* Полоса под топбаром с breadcrumbs — НЕ sticky, уезжает при прокрутке. */
.breadcrumbs-bar {
	padding: 0.4rem 1rem;
	font-size: 0.85rem;
	color: var(--muted);
	background: var(--app-bg);
	border-bottom: 1px solid var(--border);
}
.breadcrumbs-bar:empty { display: none; }
.breadcrumbs-bar a { color: var(--text); text-decoration: none; }
.breadcrumbs-bar a:hover { color: var(--primary); }
.breadcrumbs-bar .sep { margin: 0 0.4rem; color: var(--muted); }
/* Старый класс .breadcrumbs (внутри страниц) — оставляем совместимым */
.breadcrumbs { font-size: 0.85rem; color: var(--muted); }
.breadcrumbs a { color: var(--text); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs .sep { margin: 0 0.4rem; color: var(--muted); }

.search-form { margin: 0; }
.search-input {
	width: 260px;
	padding: 0.3rem 0.6rem;
	border: 1px solid var(--border-strong);
	border-radius: 6px;
	background: var(--app-bg);
	color: var(--text);
	font-size: 0.85rem;
}
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-bg); }

.theme-toggle {
	background: transparent;
	border: 1px solid var(--border-strong);
	border-radius: 6px;
	padding: 0.25rem 0.5rem;
	font-size: 1rem;
	cursor: pointer;
	line-height: 1;
	color: var(--text);
}
.theme-toggle:hover { background: var(--surface-2); }
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: inline; }

.app-content { padding: 1.25rem 1.5rem; min-width: 0; }

/* Картинки/кнопки от Pico — стили перекраиваем под shadcn для согласованности */
[data-theme="dark"] {
	--pico-color: var(--text);
	--pico-muted-color: var(--muted);
	--pico-background-color: var(--app-bg);
	--pico-card-background-color: var(--surface);
	--pico-card-sectioning-background-color: var(--surface-2);
	--pico-card-border-color: var(--border);
	--pico-primary: var(--primary);
}

.table-wrap {
	/* Топбар не sticky — уезжает при прокрутке. Таблица прилипает к самому верху
	   окна (top:0). Внутри — свой scroll-контекст для sticky-vc/thead/tfoot/pinned. */
	position: sticky;
	top: 0;
	max-height: 100vh;
	overflow-x: auto;
	overflow-y: auto;
}

#report-table {
	font-size: 0.9rem;
	width: auto;
	min-width: 100%;
	white-space: nowrap;
}

#report-table th {
	position: sticky;
	top: 0;
	background: var(--pico-card-background-color);
	cursor: pointer;
	user-select: none;
}

#report-table th.sorted-asc::after  { content: " ▲"; opacity: 0.7; font-size: 0.8em; }
#report-table th.sorted-desc::after { content: " ▼"; opacity: 0.7; font-size: 0.8em; }

#report-table .audit-col   { width: 36px; text-align: center; cursor: default; }
#report-table .comment-col { min-width: 180px; cursor: text; }
#report-table .nm-link, #daily-table .nm-link, #op-pivot-table .nm-link { color: var(--pico-muted-color); font-size: 0.75em; text-decoration: none; }
#report-table .nm-link:hover, #daily-table .nm-link:hover, #op-pivot-table .nm-link:hover { color: var(--pico-primary); text-decoration: underline; }
#report-table .sticky-vc strong { font-size: 0.9rem; }
#daily-table .sticky-vc strong { font-size: 0.72rem; }

/* Daily pivot 14 дней */
#daily-table {
	font-size: 0.7rem;
	white-space: nowrap;
	/* separate (не collapse!) — иначе sticky-ячейки теряют общие границы
	   при «всплытии» над прокручиваемым телом. Границы рисуем явно на каждой ячейке. */
	border-collapse: separate;
	border-spacing: 0;
}
#daily-table th, #daily-table td {
	padding: 0.15rem 0.3rem;
	border-bottom: 1px solid var(--pico-card-border-color);
	border-right:  1px solid var(--pico-card-border-color);
}
/* Левый край таблицы — без двойной границы (sticky-vc сам нарисует right) */
#daily-table tr > *:first-child { border-left: 1px solid var(--pico-card-border-color); }
/* Верхняя граница только у первой строки шапки */
#daily-table thead tr:first-child th { border-top: 1px solid var(--pico-card-border-color); }
/* row 2 шапки — собственный border-top, чтобы линия между датой и шт/выр/рек/ПП
   оставалась видна при скролле (row 2 перекрывает row 1 на 1px ради устранения щели). */
#daily-table thead tr:nth-child(2) th { border-top: 1px solid var(--pico-card-border-color); }
#daily-table .sticky-vc {
	position: sticky; left: 0;
	background: var(--pico-card-background-color);
	min-width: 150px; max-width: 320px; width: 320px; z-index: 1;
	box-sizing: border-box;   /* width включает border */
	border-right: 2px solid var(--pico-card-border-color);
	/* Артикул всегда в ОДНУ строку; не влез — троеточие, полный текст в tooltip. */
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.2;
}
/* Сам vendor_code (strong) — обрезаем с троеточием */
#daily-table .sticky-vc strong {
	display: inline-block;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	vertical-align: bottom;
}
/* z-index наследуется из строки 607 (=4), та же причина что в op-pivot-table. */
#daily-table thead .sticky-vc { background: var(--pico-card-sectioning-background-color); }
#daily-table .day-group {
	text-align: center;
	border-left: 3px solid var(--pico-card-border-color);
	background: var(--pico-card-sectioning-background-color);
}
#daily-table .metric-sub {
	font-size: 0.58rem;
	font-weight: normal;
	color: var(--pico-muted-color);
	border-left: 1px solid var(--pico-card-border-color);
}
/* Разделитель между днями (первая ячейка дня в row 2 thead, tbody и tfoot).
   Должно идти ПОСЛЕ .metric-sub, иначе border-left:1px из .metric-sub перекроет. */
#daily-table .day-start { border-left: 3px solid var(--pico-card-border-color) !important; }
#daily-table tbody tr.row-even td { background: var(--pico-card-sectioning-background-color); }
#daily-table tbody tr.row-even td.sticky-vc { background: var(--pico-card-sectioning-background-color); }
#daily-table .empty-cell { color: var(--pico-muted-color); }
#daily-table td.pp-positive { color: #2e7d32; }
#daily-table td.pp-negative { color: #c62828; }
/* Стрелки тренда vs предыдущий период в ячейках «шт» (и «ср. цен» в daily).
   Кол-во стрелок: 1 = 10-30%, 2 = 30-50%, 3 = >50%.
   Селекторы без id, чтобы работало и в #daily-table, и в #op-pivot-table. */
.trend-up   { color: #2e7d32; font-weight: bold; }
.trend-down { color: #c62828; font-weight: bold; }

/* Легенда стрелок — компактный блок над таблицей */
.trend-legend {
	font-size: 0.78rem;
	color: var(--pico-muted-color);
	background: var(--pico-card-sectioning-background-color);
	padding: 0.35rem 0.6rem;
	border-radius: 0.3rem;
	margin: 0.4rem 0;
	border-left: 3px solid #1976d2;
}

/* Подсветка нужной строки — для слежения при сравнении (ОП-таблица).
   Лампочка 💡 слева от артикула: тусклая → клик → яркая + жёлтый фон строки. */
.row-highlight-toggle {
	background: none; border: none; padding: 0 4px 0 0; margin: 0;
	font-size: 1rem; cursor: pointer;
	opacity: 0.7;
	vertical-align: baseline; transition: opacity 0.15s, text-shadow 0.15s, transform 0.15s;
}
.row-highlight-toggle:hover { opacity: 1; transform: scale(1.15); }
tr.row-highlighted .row-highlight-toggle {
	opacity: 1;
	text-shadow: 0 0 6px #f9a825, 0 0 12px #ffeb3b;
}
/* Светло-фиолетовый, чтобы не путать с жёлтым row-withdraw и голубым pinned-day.
   Полный набор переопределений (включая withdraw/zebra/pinned) — в конце файла:
   row-withdraw селекторы имеют id+3 классов, поэтому базовый tr.row-highlighted
   их не перебивает. См. "=== row-highlighted: финальное переопределение ===". */
tr.row-highlighted td { background: #f3e5f5 !important; }
tr.row-highlighted td.sticky-vc { background: #e1bee7 !important; }
#daily-table .audit-extra {
	width: 75px;
	max-width: 75px;
	padding: 0.1rem 0.25rem;
	height: 1.4rem;
	font-size: 0.65rem;
}

/* Скрываемая колонка «Доп. заказ» */
#daily-table.hide-extra-order .extra-order-col { display: none; }

/* Скрываемая колонка «Цена» (manual_price) — по умолчанию скрыта */
#daily-table.hide-price-col .price-col { display: none; }
.report-meta-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.report-meta-actions button { margin: 0; }
#daily-table .manual-price-input {
	width: 75px; max-width: 75px;
	padding: 0.1rem 0.3rem; margin: 0;
	height: 1.5rem; font-size: 0.7rem;
	text-align: right; box-sizing: border-box;
}
#daily-table .manual-price-input::placeholder { color: var(--pico-muted-color); opacity: 0.7; }
#daily-table .price-cell-wrap { display: flex; gap: 0.25rem; align-items: center; justify-content: flex-end; }
#daily-table .apply-price-btn {
	margin: 0; padding: 0 0.35rem;
	height: 1.5rem; width: 1.6rem;
	display: inline-flex; align-items: center; justify-content: center;
	font-size: 0.85rem; line-height: 1;
	border-radius: 4px; cursor: pointer;
	background: var(--pico-primary); color: #fff !important; border: none;
	white-space: nowrap; box-sizing: border-box;
	flex-shrink: 0;
}
#daily-table .apply-price-btn:hover { filter: brightness(0.92); color: #fff !important; }
#daily-table .apply-price-btn:disabled { opacity: 0.6; cursor: progress; }
#daily-table .apply-price-btn.price-applied { background: #4caf50; }
#daily-table .apply-price-btn.price-applied-error { background: #e05b5b; }
#daily-table .promo-badge {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 1.7rem; height: 1.5rem !important;
	width: auto !important; margin: 0 !important; padding: 0 0.3rem !important;
	border: 0; cursor: pointer;
	font-size: 0.7rem; line-height: 1;
	border-radius: 4px;
	color: var(--pico-muted-color);
	background: var(--pico-card-sectioning-background-color);
	font-variant-numeric: tabular-nums;
}
#daily-table .promo-badge:hover { filter: brightness(0.95); }
#daily-table .promo-badge.promo-on { background: #ffd54f; color: #5d4200; font-weight: 600; }
#daily-table .promo-badge.promo-offers { background: #c8e6c9; color: #1b5e20; font-weight: 600; }

/* Модалка акций (переиспользует .ah-modal*) */
.promo-modal-title { margin: 0 0 0.7rem; font-size: 1.05rem; }
.promo-modal-note { margin: 0.6rem 0 0; color: var(--pico-muted-color); }
.promo-tbl { border-collapse: collapse; font-size: 0.82rem; width: auto; }
.promo-tbl th, .promo-tbl td {
	border: 1px solid var(--pico-card-border-color);
	padding: 0.3rem 0.55rem; white-space: nowrap;
}
.promo-tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.promo-tbl .promo-row-joined { opacity: 0.55; }
.promo-enter-btn {
	width: auto !important; height: auto !important;
	margin: 0 !important; padding: 0.15rem 0.6rem !important;
	font-size: 0.8rem; cursor: pointer;
}
.promo-joined-mark { font-size: 0.75rem; color: var(--pico-ins-color, #2e7d32); }


/* === /admin/supplies-upload — поставки на склады === */
.supplies-page { max-width: 720px; }
.supplies-h { margin-bottom: 1.25rem; }

/* Карточка загрузки */
.supplies-upload-card {
	background: var(--pico-card-background-color);
	border: 1px solid var(--pico-card-border-color);
	border-radius: 10px;
	padding: 1rem 1.25rem;
	margin: 0 0 1.5rem;
}
.supplies-upload-grid {
	display: grid;
	grid-template-columns: 220px 1fr auto;
	gap: 0.75rem;
	align-items: end;
}
.supplies-field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.supplies-field label {
	font-size: 0.78rem;
	color: var(--pico-muted-color);
	margin: 0;
}
.supplies-field input,
.supplies-field button { margin: 0; height: 38px; box-sizing: border-box; }
/* Кастомный file-input: кнопка «Выберите файл» + имя файла рядом */
.supplies-file-hidden {
	position: absolute;
	width: 1px; height: 1px;
	opacity: 0; overflow: hidden;
	pointer-events: none;
}
.supplies-file-wrap {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	height: 38px;
	min-width: 0;
}
.supplies-file-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 38px;
	padding: 0 1.1rem;
	background: var(--pico-primary);
	color: #fff !important;
	border: 1px solid var(--pico-primary);
	border-radius: 6px;
	font-size: 0.9rem;
	font-weight: 500;
	cursor: pointer;
	white-space: nowrap;
	margin: 0;
	flex-shrink: 0;
	box-sizing: border-box;
	transition: filter 0.12s ease;
	text-decoration: none;
}
.supplies-file-btn:hover { filter: brightness(0.92); color: #fff !important; }
.supplies-file-btn:active { filter: brightness(0.85); }
.supplies-file-name {
	font-size: 0.85rem;
	color: var(--pico-muted-color);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	min-width: 0;
	flex: 1;
}
.supplies-field-btn button {
	white-space: nowrap;
	padding: 0 1.5rem;
	min-width: 130px;
}
.supplies-hint {
	margin: 0.75rem 0 0;
	font-size: 0.78rem;
	color: var(--pico-muted-color);
}

/* Список складов — каждый в своей карточке */
.supplies-wh-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}
.supplies-wh-card {
	display: grid;
	grid-template-columns: 1fr 110px 100px;
	gap: 0.75rem;
	align-items: center;
	background: var(--pico-card-background-color);
	border: 1px solid var(--pico-card-border-color);
	border-radius: 10px;
	padding: 0.55rem 0.85rem;
}
.supplies-wh-name { font-weight: 500; font-size: 0.95rem; }
.supplies-wh-qty {
	text-align: right;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	color: var(--pico-color);
}
.supplies-wh-form { margin: 0; }

.supplies-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 32px;
	padding: 0 0.5rem;
	border-radius: 6px;
	font-size: 0.82rem;
	line-height: 1;
	font-weight: 500;
	border: none;
	cursor: pointer;
	text-decoration: none;
	color: #fff;
	box-sizing: border-box;
	transition: background 0.12s ease;
}
.supplies-btn-delete { background: #e05b5b; }
.supplies-btn-delete:hover { background: #c94747; }
.supplies-btn-view { background: #4caf50; }
.supplies-btn-view:hover { background: #3d8b40; color: #fff; }

.supplies-empty {
	color: var(--pico-muted-color);
	font-size: 0.9rem;
	padding: 1.5rem 0;
	text-align: center;
}

.supplies-result {
	margin-top: 1.5rem;
	padding: 1rem 1.25rem;
	border-radius: 10px;
}
.supplies-result ul { margin: 0.5rem 0 0; padding-left: 1.2rem; }
.supplies-diag {
	white-space: pre-wrap;
	font-size: 0.78rem;
	background: var(--pico-card-sectioning-background-color);
	padding: 0.5rem 0.75rem;
	border-radius: 6px;
	margin: 0.5rem 0 0;
}

@media (max-width: 700px) {
	.supplies-upload-grid { grid-template-columns: 1fr; }
	.supplies-field-btn button { width: 100%; }
	.supplies-wh-card { grid-template-columns: 1fr 90px; }
	.supplies-wh-qty { grid-column: 1 / -1; text-align: left; margin-top: 0.15rem; }
}

/* Закреплённый последний день — прилипает к левому краю после колонки «Артикул»
   при горизонтальном скролле. left-значение задаёт JS (daily_pin.js).
   Непрозрачный фон — иначе ячейки сзади просвечивают при скролле. */
#daily-table .pinned-day {
	position: sticky !important;
	background: #E5EFFA !important;
	z-index: 1;
}
#daily-table thead .pinned-day { z-index: 4; }
#daily-table tfoot .pinned-day { z-index: 4; }
#daily-table tbody tr.row-even td.pinned-day,
#daily-table tbody tr.row-odd  td.pinned-day { background: #E5EFFA !important; }

/* Жёсткое правило для row 2 шапки и tfoot — самая высокая специфичность среди
   всех правил, обращающихся к этим ячейкам. Гарантирует sticky на them
   независимо от того, успел ли JS поставить класс .pinned-day. */
#daily-table thead tr:nth-child(2) th[data-day-idx="0"],
#daily-table tfoot tr.totals-row th[data-day-idx="0"] {
	position: sticky !important;
	background: #E5EFFA !important;
	z-index: 5 !important;
}
#daily-table tbody tr td[data-day-idx="0"] {
	position: sticky !important;
	background: #E5EFFA !important;
	z-index: 1 !important;
}
#daily-table thead .day-group[data-day-idx="0"] {
	position: sticky !important;
	background: #E5EFFA !important;
	z-index: 5 !important;
}

/* Сортировка по «Дней хватит» */
#daily-table .sortable-days {
	cursor: pointer;
	user-select: none;
	text-decoration: underline dotted;
	text-underline-offset: 3px;
}
#daily-table .sortable-days:hover { background: #E5EFFA; }
#daily-table .sortable-days .sort-arrow { color: var(--pico-primary); font-weight: bold; }
#daily-table .sortable-days .sort-idle { color: var(--pico-muted-color); opacity: 0.7; }

/* Универсальная сортировка по любому столбцу (ПП и ОП) */
#daily-table .col-sort, #op-pivot-table .col-sort { cursor: pointer; user-select: none; }
#daily-table .col-sort:hover, #op-pivot-table .col-sort:hover { background: #E5EFFA; }
#daily-table .col-sort .sort-arrow, #op-pivot-table .col-sort .sort-arrow { color: var(--pico-primary); font-weight: bold; }
#daily-table .col-sort .sort-idle, #op-pivot-table .col-sort .sort-idle { color: var(--pico-muted-color); opacity: 0.55; font-weight: normal; }
#toggle-extra-order.active {
	background: var(--pico-primary);
	color: #fff;
	border-color: var(--pico-primary);
}

#daily-table tfoot .totals-row th {
	background: var(--pico-card-sectioning-background-color);
	font-weight: 600;
	border-top: 2px solid var(--pico-primary);
	position: sticky;
	bottom: 0;
	z-index: 2;
}
#daily-table tfoot .totals-row .sticky-vc {
	z-index: 3;  /* пересечение sticky-vc + sticky-bottom */
}

/* Sticky thead для всех таблиц */
#daily-table thead th,
#report-table thead th,
#op-pivot-table thead th {
	position: sticky;
	top: 0;
	z-index: 2;
	background: var(--pico-card-sectioning-background-color);
}
#daily-table thead .sticky-vc,
#report-table thead .sticky-vc,
#op-pivot-table thead .sticky-vc { z-index: 4; }

/* Двухстрочный заголовок: высота первого ряда зафиксирована жёстко, второй
   ряд прилипает ровно на эту высоту — иначе ряды разъезжаются и первый
   (с датами) уходит под скролл. */
#daily-table thead tr:first-child th,
#op-pivot-table thead tr:first-child th {
	height: 34px;
	box-sizing: border-box;
}
#daily-table thead tr:nth-child(2) th { top: 34px; z-index: 2; }
#op-pivot-table thead tr:nth-child(2) th { top: 34px; z-index: 2; }

/* Дневные комментарии */
#daily-table .comment-cell {
	cursor: pointer;
	text-align: center;
	width: 28px;
	padding: 0 4px;
	border-right: 1px solid var(--pico-card-border-color);
}
#daily-table .comment-cell:hover {
	background: var(--pico-card-sectioning-background-color);
}
#daily-table .comment-cell.has-comment {
	background: rgba(255, 213, 79, 0.45) !important;
}
/* ds-bg-* — days_of_stock / days_left, одинаковые тона на всех таблицах.
   Очень светлые (полпути от Material 50 к белому) — сигнал виден, но не давит. */
#daily-table .ds-bg-crit,
#report-table td.ds-bg-crit,
#op-pivot-table td.ds-bg-crit { background: #ff5252 !important; color: #fff !important; font-weight: 700; }  /* <15 дн — красный алерт (только «Дней хватит ВБ») */
#daily-table .ds-bg-1,
#report-table td.ds-bg-1,
#op-pivot-table td.ds-bg-1 { background: #ffebee !important; }  /* <40 — критично мало (Material red-50) */
#daily-table .ds-bg-2,
#report-table td.ds-bg-2,
#op-pivot-table td.ds-bg-2 { background: #fffef3 !important; }  /* 40-70 — мало (полу-yellow-50) */
#daily-table .ds-bg-3,
#report-table td.ds-bg-3,
#op-pivot-table td.ds-bg-3 { background: #f3faf4 !important; }  /* 71-110 — норма (полу-green-50) */
#daily-table .ds-bg-4,
#report-table td.ds-bg-4,
#op-pivot-table td.ds-bg-4 { background: #fff9ef !important; }  /* 111-130 — многовато (полу-orange-50) */
#daily-table .ds-bg-5,
#report-table td.ds-bg-5,
#op-pivot-table td.ds-bg-5 { background: #fff5f6 !important; }  /* >130 — залежавшиеся (полу-red-50) */

#report-table .audit-extra {
	width: 100%;
	max-width: 60px;
	padding: 0.2rem 0.3rem;
	margin: 0;
	height: 1.6rem;
	font-size: 0.85rem;
	text-align: right;
}

/* Sticky vendor_code колонка слева */
#report-table .sticky-vc {
	position: sticky;
	left: 36px;  /* после audit-col */
	background: var(--pico-card-background-color);
	z-index: 1;
}
#report-table thead .sticky-vc { z-index: 2; }

/* Зебра */
#report-table tbody tr.row-even td { background: var(--pico-card-sectioning-background-color); }
#report-table tbody tr.row-even td.sticky-vc { background: var(--pico-card-sectioning-background-color); }

/* Цветовые шкалы — discount % */
#report-table td.dr-bg-1 { background: rgba(102, 187, 106, 0.4); }  /* 0-12 — зелёный лёгкий */
#report-table td.dr-bg-2 { background: rgba(255, 235, 59, 0.5); }   /* 12-20 — жёлтый */
#report-table td.dr-bg-3 { background: rgba(255, 152, 0, 0.5); }    /* 20-35 — оранжевый */
#report-table td.dr-bg-4 { background: rgba(229, 57, 53, 0.55); color: #fff; }  /* >35 — красный */
#report-table .audit-check { transform: scale(1.2); margin: 0; }
#report-table .audit-comment {
	margin: 0;
	padding: 0.2rem 0.4rem;
	font-size: 0.85rem;
	border: 1px solid transparent;
	background: transparent;
	width: 100%;
	min-height: unset;
	height: 1.6rem;
}
#report-table .audit-comment:focus {
	border-color: var(--pico-primary);
	background: var(--pico-card-background-color);
}
.audit-saving { outline: 2px solid #ffd54f; }
.audit-saved  { outline: 2px solid #66bb6a; transition: outline 0.4s; }
.audit-error  { outline: 2px solid #e53935; }

/* Tabs Daily / OP */
.group-tabs {
	display: flex;
	gap: 0.5rem;
	margin: 1rem 0;
	border-bottom: 1px solid var(--pico-card-border-color);
}
.group-tabs a {
	padding: 0.5rem 1rem;
	text-decoration: none;
	color: var(--pico-muted-color);
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
}
.group-tabs a:hover { color: inherit; }
.group-tabs a.active {
	color: inherit;
	border-bottom-color: var(--pico-primary);
	font-weight: 500;
}

/* Settings form (group_settings.html) */
.settings-form {
	max-width: 800px;
	margin-top: 1rem;
}
.settings-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 1rem;
	margin-bottom: 1rem;
}
.settings-form label { font-size: 0.9rem; margin-bottom: 0.2rem; }
.settings-form small { color: var(--pico-muted-color); font-size: 0.75rem; display: block; margin-top: -0.4rem; }
.settings-form pre   { font-size: 0.8rem; line-height: 1.4; padding: 0.6rem; background: var(--pico-card-sectioning-background-color); border-radius: 0.4rem; }

/* Summary table */
#summary-table .rnp-divider td { border-top: 2px solid var(--pico-primary); }
#summary-table .pp-positive { color: #2e7d32; font-weight: 500; }
#summary-table .pp-negative { color: #c62828; font-weight: 500; }
#summary-table .warn-link   { color: #ef6c00; }

/* Admin dashboard */
/* Ссылки на рекламу в настройках группы */
.ad-links-block { margin: 1rem 0; }
.ad-links-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 0.5rem; }
.ad-links-table th, .ad-links-table td {
	border: 1px solid var(--pico-card-border-color);
	padding: 0.3rem 0.5rem;
	text-align: left;
}
.ad-links-table input { margin: 0; width: 100%; }
.ad-links-table thead th { background: var(--pico-card-sectioning-background-color); }

/* Кнопка-стрелочка «ссылка на рекламу» рядом с артикулом */
.ad-link-arrow,
.price-link-arrow {
	text-decoration: none;
	font-size: 0.85rem;
	margin-left: 0.2rem;
}

/* Страница «Не попали в фильтры» — группировка по шаблонам */
.unmatched-pat { margin: 0.4rem 0; border: 1px solid var(--pico-card-border-color); border-radius: 0.4rem; }
.unmatched-pat summary {
	padding: 0.5rem 0.8rem;
	cursor: pointer;
	font-size: 0.9rem;
}
.unmatched-pat summary code { font-weight: 600; }
.unmatched-cnt {
	margin-left: 0.5rem;
	font-size: 0.78rem;
	color: var(--pico-muted-color);
	background: var(--pico-card-sectioning-background-color);
	padding: 0.1rem 0.5rem;
	border-radius: 999px;
}
.unmatched-pat .ad-links-table { margin: 0 0.8rem 0.8rem; width: calc(100% - 1.6rem); }

/* Форма ручной привязки артикула к группе (override) */
.override-form {
	display: flex;
	gap: 0.4rem;
	margin: 0;
	align-items: center;
}
.override-form select { margin: 0; padding: 0.2rem 0.4rem; font-size: 0.8rem; min-width: 14rem; }
.override-form button { margin: 0; padding: 0.2rem 0.7rem; font-size: 0.8rem; white-space: nowrap; }

/* Список ручных привязок в настройках группы */
.overrides-block { margin: 1.2rem 0; }
.overrides-block h4 { margin: 0 0 0.4rem; }
.overrides-block ul { list-style: none; padding: 0; margin: 0; }
.overrides-block li { padding: 0.25rem 0; display: flex; gap: 0.6rem; align-items: center; }
.overrides-block li form { margin: 0; }
.overrides-block li button { margin: 0; padding: 0.1rem 0.6rem; font-size: 0.75rem; }

/* История действий */
.activity-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.activity-table th, .activity-table td {
	border: 1px solid var(--pico-card-border-color);
	padding: 0.35rem 0.6rem;
	text-align: left;
	vertical-align: top;
}
.activity-table thead th { background: var(--pico-card-sectioning-background-color); }
.activity-table tbody tr:hover { background: var(--pico-card-sectioning-background-color); }
.act-when { white-space: nowrap; color: var(--pico-muted-color); }
.act-tag { white-space: nowrap; font-size: 0.78rem; }
.act-comment  { color: #2563eb; }
.act-audit    { color: #16a34a; }
.act-settings { color: #ea580c; }

/* Режим просмотра (impersonation) */
.impersonate-bar {
	display: flex;
	align-items: center;
	gap: 0.7rem;
	padding: 0.4rem 1rem;
	background: #fff3cd;
	border-bottom: 1px solid #e0a800;
	font-size: 0.85rem;
	color: #7d5a00;
	/* Липнет к верху экрана — кнопка «Вернуться в админа» видна всегда,
	   даже при прокрутке (чтобы не застревать в режиме просмотра). */
	position: sticky;
	top: 0;
	z-index: 1000;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}
/* Плашка «когда обновлялись данные» (МСК) — тонкая полоса под шапкой в Ozon-вкладках */
.data-fresh-bar {
	padding: 0.25rem 1rem;
	background: #eef2f7;
	border-bottom: 1px solid #d9e0e8;
	font-size: 0.8rem;
	color: #5b6b7d;
	text-align: right;
}
.data-fresh-bar b { color: #2c3e50; font-weight: 600; }
.imp-back-btn {
	width: auto;
	margin: 0;
	padding: 0.2rem 0.7rem;
	background: #e0a800;
	border: 0;
	border-radius: 0.3rem;
	font-size: 0.8rem;
	color: #fff;
	cursor: pointer;
}
.imp-view-btn {
	width: auto;
	margin: 0;
	padding: 0.15rem 0.5rem;
	background: none;
	border: 1px solid var(--pico-card-border-color);
	border-radius: 0.3rem;
	font-size: 0.75rem;
	cursor: pointer;
}
.imp-view-btn:hover { border-color: #2563eb; color: #2563eb; }

/* Колонка «Сегодня» (комментарий) в дневной таблице */
#daily-table .today-col {
	background: rgba(37, 99, 235, 0.07);
	border-left: 2px solid #2563eb;
	text-align: center;
}

/* Кнопка «Назад» в шапке */
.nav-back {
	margin: 0 0.4rem 0 0;
	width: auto;
	padding: 0.25rem 0.7rem;
	background: none;
	border: 1px solid var(--pico-card-border-color);
	border-radius: 0.35rem;
	font-size: 0.8rem;
	color: var(--pico-muted-color);
	cursor: pointer;
	white-space: nowrap;
}
.nav-back:hover { border-color: var(--pico-primary); color: var(--pico-primary); }

/* Кнопка выхода — компактная, в углу шапки */
.logout-form { margin: 0 0 0 auto; }
.logout-btn {
	margin: 0;
	width: auto;
	padding: 0.25rem 0.7rem;
	background: none;
	border: 1px solid var(--pico-card-border-color);
	border-radius: 0.35rem;
	font-size: 0.8rem;
	color: var(--pico-muted-color);
	cursor: pointer;
}
.logout-btn:hover { border-color: #c62828; color: #c62828; }

/* Плашка свежести данных — единая на всех страницах */
.freshness-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem 1.4rem;
	padding: 0.4rem 1rem;
	background: var(--pico-card-sectioning-background-color);
	border-bottom: 1px solid var(--pico-card-border-color);
	font-size: 0.78rem;
	color: var(--pico-muted-color);
}
.freshness-bar b { color: var(--pico-color); font-weight: 600; }

/* === Дашборд === */
.dash-section-title {
	font-size: 0.85rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--pico-muted-color);
	margin: 1.6rem 0 0.6rem;
}

.kpi-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
	gap: 0.9rem;
	margin: 0.6rem 0 0.5rem;
}
.kpi-card {
	padding: 0.85rem 1rem 0.9rem 1.05rem;
	border: 1px solid var(--pico-card-border-color);
	border-left: 4px solid var(--pico-muted-color);
	border-radius: 0.55rem;
	background: var(--pico-card-background-color);
	transition: transform 0.1s, box-shadow 0.1s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08); }
.kpi-card.acc-red    { border-left-color: #c62828; }
.kpi-card.acc-orange { border-left-color: #ef6c00; }
.kpi-card.acc-green  { border-left-color: #16a34a; }
.kpi-card.acc-blue   { border-left-color: #2563eb; }
.kpi-label {
	font-size: 0.72rem;
	color: var(--pico-muted-color);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
.kpi-value {
	font-size: 1.35rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	margin-top: 0.35rem;
	line-height: 1.15;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.kpi-value.alert { color: #c62828; }
.kpi-value.warn  { color: #ef6c00; }
.kpi-value-small {
	font-size: 0.95rem;
	font-weight: 600;
	margin-top: 0.5rem;
	color: var(--pico-muted-color);
}

.chart-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 1rem;
	margin: 0.4rem 0 1rem;
}
.chart-card {
	padding: 1rem 1.1rem 1.2rem;
	border: 1px solid var(--pico-card-border-color);
	border-radius: 0.55rem;
	background: var(--pico-card-background-color);
}
.chart-card h3 { margin: 0 0 0.7rem; font-size: 0.95rem; }
.chart-card .chart-box { position: relative; height: 260px; }
.chart-wide { grid-column: span 2; }
@media (max-width: 800px) {
	.chart-grid { grid-template-columns: 1fr; }
	.chart-wide { grid-column: span 1; }
}

/* OP pivot — те же приёмы что в daily: separate borders, узкий шрифт,
   sticky-vc с эллипсисом, толстые разделители между неделями. */
#op-pivot-table {
	font-size: 0.7rem;
	white-space: nowrap;
	border-collapse: separate;
	border-spacing: 0;
}
#op-pivot-table th, #op-pivot-table td {
	padding: 0.15rem 0.3rem;
	border-bottom: 1px solid var(--pico-card-border-color);
	border-right:  1px solid var(--pico-card-border-color);
}
#op-pivot-table tr > *:first-child { border-left: 1px solid var(--pico-card-border-color); }
#op-pivot-table thead tr:first-child th { border-top: 1px solid var(--pico-card-border-color); }
#op-pivot-table thead tr:nth-child(2) th { border-top: 1px solid var(--pico-card-border-color); }

#op-pivot-table .sticky-vc {
	position: sticky; left: 0;
	background: var(--pico-card-background-color);
	min-width: 150px; max-width: 320px; width: 320px; z-index: 1;
	box-sizing: border-box;   /* width включает border */
	border-right: 2px solid var(--pico-card-border-color);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.2;
}
#op-pivot-table .sticky-vc strong {
	display: inline-block;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	vertical-align: bottom;
	font-size: 0.72rem;
}
/* z-index не задаём — он унаследован из строки 607 (=4), иначе подзаголовки
   недель (z=2) при равенстве побеждали бы по DOM-позиции и наезжали на артикул. */
#op-pivot-table thead .sticky-vc { background: var(--pico-card-sectioning-background-color); }
#op-pivot-table tbody tr.row-even td.sticky-vc { background: var(--pico-card-sectioning-background-color); }

#op-pivot-table .week-group {
	text-align: center;
	border-left: 3px solid var(--pico-card-border-color);
	background: var(--pico-card-sectioning-background-color);
}
#op-pivot-table .metric-sub {
	font-size: 0.58rem;
	font-weight: normal;
	color: var(--pico-muted-color);
	border-left: 1px solid var(--pico-card-border-color);
}
/* Разделитель между неделями (первая ячейка недели в row 2 thead, tbody, tfoot) */
#op-pivot-table .week-start { border-left: 3px solid var(--pico-card-border-color) !important; }

#op-pivot-table tbody tr.row-even td { background: var(--pico-card-sectioning-background-color); }
#op-pivot-table .op-negative { color: #c62828; }

/* Сортировка по ОП последней (закреплённой) недели — 3-фазная кнопка */
#op-pivot-table .sortable-op {
	cursor: pointer;
	user-select: none;
	text-decoration: underline dotted;
	text-underline-offset: 2px;
}
#op-pivot-table .sortable-op:hover { background: #E5EFFA; }
#op-pivot-table .sortable-op .sort-arrow { color: var(--pico-primary); font-weight: bold; }
#op-pivot-table .sortable-op .sort-idle { color: var(--pico-muted-color); opacity: 0.7; }

/* Comment-cell для OP — те же стили что в daily */
#op-pivot-table .comment-cell {
	cursor: pointer;
	text-align: center;
	width: 28px;
}
#op-pivot-table .comment-cell.has-comment {
	background: rgba(255, 213, 79, 0.45) !important;
}

/* Кнопка комментария — «+» / 💬 в кружочке (daily + op) */
.daily-comment-btn {
	background: transparent;
	border: 1px solid var(--pico-muted-border-color, #ccc);
	border-radius: 50%;
	width: 20px;
	height: 20px;
	padding: 0;
	margin: 0;
	font-size: 0.72rem;
	line-height: 1;
	color: var(--pico-muted-color);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}
.comment-cell:hover .daily-comment-btn {
	border-color: var(--pico-primary);
	color: var(--pico-primary);
}
.comment-cell.has-comment .daily-comment-btn { border-color: var(--pico-primary); }

/* Закреплённая «новейшая» неделя — sticky слева сразу за Артикул. left задаёт JS. */
#op-pivot-table .pinned-week {
	position: sticky !important;
	background: #E5EFFA !important;
	z-index: 1;
}
#op-pivot-table thead .pinned-week,
#op-pivot-table tfoot .pinned-week { z-index: 4; }
#op-pivot-table tbody tr.row-even td.pinned-week,
#op-pivot-table tbody tr.row-odd  td.pinned-week { background: #E5EFFA !important; }
#op-pivot-table thead tr:nth-child(2) th[data-week-idx="0"],
#op-pivot-table tfoot tr.totals-row th[data-week-idx="0"],
#op-pivot-table thead .week-group[data-week-idx="0"] {
	position: sticky !important;
	background: #E5EFFA !important;
	z-index: 5 !important;
}
#op-pivot-table tbody tr td[data-week-idx="0"] {
	position: sticky !important;
	background: #E5EFFA !important;
	z-index: 1 !important;
}

/* ДРР цветовые шкалы — только отклонения (жёлтый/оранжевый/красный).
   Нормальный ДРР (<12%) не подсвечивается. */
#op-pivot-table td.drr-bg-2 { background: #fffef3 !important; }      /* 12-20 — жёлтый (полпути от yellow-50 к белому) */
#op-pivot-table td.drr-bg-3 { background: #fff9ef !important; }      /* 20-35 — оранжевый (полпути от orange-50 к белому) */
#op-pivot-table td.drr-bg-4 { background: #fff5f6 !important; }      /* >35 — красный (полпути от red-50 к белому) */
/* Закреплённая неделя — ДРР-цвет должен побеждать голубую sticky-подсветку
   и быть на ступеньку темнее основных, чтобы pinned-столбец читался. */
#op-pivot-table tbody tr td.pinned-week.drr-bg-2 { background: #fffde7 !important; }
#op-pivot-table tbody tr td.pinned-week.drr-bg-3 { background: #fff3e0 !important; }
#op-pivot-table tbody tr td.pinned-week.drr-bg-4 { background: #ffebee !important; }
/* То же для days_left — блок должен быть ПОСЛЕ зебры pinned (строка ~1091),
   иначе зебра побеждает по cascade при равной специфичности. */
#op-pivot-table tbody tr td.pinned-week.ds-bg-1 { background: #ffcdd2 !important; }
#op-pivot-table tbody tr td.pinned-week.ds-bg-2 { background: #fffde7 !important; }
#op-pivot-table tbody tr td.pinned-week.ds-bg-3 { background: #e8f5e9 !important; }
#op-pivot-table tbody tr td.pinned-week.ds-bg-4 { background: #fff3e0 !important; }
#op-pivot-table tbody tr td.pinned-week.ds-bg-5 { background: #ffebee !important; }

/* Totals row */
#report-table tfoot .totals-row th,
#op-pivot-table tfoot .totals-row th {
	background: var(--pico-card-sectioning-background-color);
	font-weight: 600;
	border-top: 2px solid var(--pico-primary);
	position: sticky;
	bottom: 0;
}
#report-table tfoot .totals-row .pp-positive,
#op-pivot-table tfoot .totals-row .pp-positive { color: #2e7d32; }
#report-table tfoot .totals-row .pp-negative,
#op-pivot-table tfoot .totals-row .pp-negative { color: #c62828; }

/* ПП колонка в Daily */
#report-table td.pp-positive { color: #2e7d32; font-weight: 500; }
#report-table td.pp-negative { color: #c62828; font-weight: 500; }

/* Settings-ссылка в вкладках */
.group-tabs .settings-link {
	margin-left: auto;
	font-size: 0.85rem;
	color: var(--pico-muted-color);
}

#report-table td.num,
#report-table th.num {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

#report-table tbody tr:hover {
	background: var(--pico-card-sectioning-background-color);
}

.empty-state {
	text-align: center;
	padding: 2rem;
}

.auth-card {
	max-width: 400px;
	margin: 2rem auto;
	padding: 2rem;
	border: 1px solid var(--pico-card-border-color);
	border-radius: 0.5rem;
}

.flash {
	padding: 0.6rem 0.9rem;
	border-radius: 0.4rem;
	margin-bottom: 1rem;
	font-size: 0.9rem;
}
.flash-error   { background: #fde6e6; color: #8c1d1d; }
.flash-warning { background: #fff5d6; color: #7d5a00; }
.flash-success { background: #e0f5d8; color: #2a5d11; }

.error {
	color: #b21f1f;
	display: block;
	margin: -0.4rem 0 0.6rem 0;
}

.topbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1rem;
	gap: 1rem;
	flex-wrap: wrap;
}

.user-menu {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.user-menu small {
	color: var(--pico-muted-color);
}

button.small,
.user-menu button {
	margin: 0;
	padding: 0.3rem 0.7rem;
	font-size: 0.8rem;
}

.breadcrumbs a {
	color: var(--pico-muted-color);
	text-decoration: none;
	font-size: 0.9rem;
}
.breadcrumbs a:hover { text-decoration: underline; }

/* === Раздел «Таблицы» === */

/* Цвет РНП-категории — наследуется детьми через var(--rnp) */
[data-rnp="CARDS"] { --rnp: #2563eb; }
[data-rnp="CASES"] { --rnp: #7c3aed; }
[data-rnp="RINGS"] { --rnp: #0891b2; }
[data-rnp="ARMOR"] { --rnp: #ea580c; }
[data-rnp="BCA"]   { --rnp: #16a34a; }
[data-rnp="BOOKS"] { --rnp: #db2777; }
[data-rnp="CASE"]  { --rnp: #475569; }
/* Ozon: цвет per-менеджер (для секций на /ozon/my-tables) — из WB-палитры. */
[data-rnp="НАТАША"]   { --rnp: #2563eb; }  /* синий */
[data-rnp="ПОЛИНА"]   { --rnp: #7c3aed; }  /* фиолетовый */
[data-rnp="КАТЯ"]     { --rnp: #db2777; }  /* розовый */
[data-rnp="КАТЕРИНА"] { --rnp: #16a34a; }  /* зелёный */
[data-rnp="АЛЕНА"]    { --rnp: #ea580c; }  /* оранжевый */
[data-rnp="МАРИНА"]   { --rnp: #0891b2; }  /* бирюзовый */

.tables-head {
	display: flex;
	align-items: baseline;
	gap: 0.75rem;
	flex-wrap: wrap;
	margin-bottom: 0.25rem;
}
.tables-period { color: var(--pico-muted-color); font-size: 0.85rem; }

.rnp-section { margin-bottom: 1.5rem; }
.rnp-section-title {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 1.1rem 0 0.6rem;
	font-size: 0.95rem;
	font-weight: 600;
	letter-spacing: 0.5px;
}
.rnp-section-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--rnp, var(--pico-muted-color));
}
.rnp-section-count {
	font-size: 0.72rem;
	font-weight: 500;
	color: var(--pico-muted-color);
	background: var(--pico-card-sectioning-background-color);
	padding: 0.05rem 0.5rem;
	border-radius: 999px;
}
/* Строка под менеджером: новинки, заморожённые деньги + финансовые показатели */
.rnp-section-stats {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.35rem 0.9rem;
	margin: -0.2rem 0 0.7rem 1.3rem;
	font-size: 0.83rem;
	color: var(--pico-muted-color);
}
.rnp-section-stats b { color: var(--pico-color); font-weight: 600; }
.rnp-section-stats .pp-negative { color: #c62828; }
/* Финансовые показатели слегка обособлены рамкой-чипом */
.rnp-section-stats .stat-fin {
	background: var(--pico-card-sectioning-background-color);
	border-radius: 999px;
	padding: 0.05rem 0.6rem;
}

.group-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
	gap: 0.75rem;
}

.group-card {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	padding: 0.85rem 1rem;
	border: 1px solid var(--pico-card-border-color);
	border-left: 3px solid var(--rnp, var(--pico-muted-color));
	border-radius: 0.5rem;
	text-decoration: none;
	color: inherit;
	background: var(--pico-card-background-color);
	transition: transform 0.1s, box-shadow 0.1s;
}
.group-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
	text-decoration: none;
}
.rnp-tag {
	align-self: flex-start;
	display: inline-block;
	padding: 0.1rem 0.45rem;
	background: var(--rnp, var(--pico-muted-color));
	border-radius: 0.3rem;
	font-size: 0.68rem;
	font-weight: 600;
	letter-spacing: 0.5px;
	color: #fff;
}
.group-card-name {
	margin: 0;
	font-size: 1.05rem;
	line-height: 1.25;
}
.card-metrics {
	display: flex;
	flex-wrap: wrap;
	gap: 0.15rem 0.7rem;
	margin-top: auto;
	padding-top: 0.2rem;
	font-size: 0.8rem;
	color: var(--pico-muted-color);
}
.card-metrics .metric b { color: var(--pico-color); font-weight: 600; }
.metric-pos b { color: #16a34a; }
.metric-neg b { color: #c0392b; }

.group-card-warning {
	border-color: #ef6c00;
	border-left-color: #ef6c00;
	background: rgba(255, 152, 0, 0.05);
}
.group-card-warning .rnp-tag { background: #ef6c00; }

/* Секция «Менеджеры» (admin view на /my-tables) */
.section-title {
	margin: 1rem 0 0.5rem;
	font-size: 1rem;
	color: var(--pico-muted-color);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}
.managers-block { margin-bottom: 1.5rem; }
.manager-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 0.75rem;
}
.manager-card {
	margin: 0;
	padding: 0.75rem 1rem;
	background: var(--pico-card-background-color);
	border: 1px solid var(--pico-card-border-color);
	border-radius: 6px;
}
.manager-card header {
	margin: 0 0 0.4rem;
	padding: 0;
	border: 0;
	background: transparent;
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}
.manager-card header strong { font-size: 0.95rem; }
.manager-meta { color: var(--pico-muted-color); font-size: 0.8rem; }
.manager-group-list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.manager-group-list li {
	padding: 0.15rem 0;
	font-size: 0.85rem;
	display: flex;
	gap: 0.25rem;
	align-items: baseline;
}
.manager-group-list a {
	color: var(--pico-color);
	text-decoration: none;
	flex: 1;
}
.manager-group-list a:hover { color: var(--pico-primary); text-decoration: underline; }
.manager-group-list small { color: var(--pico-muted-color); }
.rnp-tag-inline {
	display: inline-block;
	font-size: 0.6rem;
	font-weight: 600;
	padding: 1px 5px;
	background: var(--rnp, var(--pico-muted-color));
	border-radius: 3px;
	color: #fff;
	margin-right: 0.25rem;
	letter-spacing: 0.5px;
}
.empty-hint {
	margin: 0.25rem 0;
	color: var(--pico-muted-color);
	font-size: 0.85rem;
}

/* Поиск артикула */
.search-results {
	list-style: none;
	padding: 0;
	margin: 0.75rem 0;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}
.search-result {
	padding: 0.75rem 1rem;
	border: 1px solid var(--border, var(--pico-card-border-color));
	border-radius: 6px;
	background: var(--surface, var(--pico-card-background-color));
}
.search-result-head { display: flex; gap: 0.5rem; align-items: baseline; }
.search-result-head strong { font-size: 1rem; }
.search-result-meta { color: var(--muted, var(--pico-muted-color)); margin: 0.25rem 0; }
.search-result-groups { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.search-result-groups a { font-size: 0.7rem; text-decoration: none; }

/* === Drill-down по артикулу (модалка истории заказов) === */
.vc-drill {
	background: none;
	border: 0;
	padding: 0;
	margin: 0;
	max-width: 100%;
	display: inline-block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	vertical-align: bottom;
	font: inherit;
	font-size: 0.62rem;
	font-weight: 700;
	color: var(--pico-primary);
	cursor: pointer;
	text-align: left;
}
.vc-drill:hover { text-decoration: underline; }

.ah-modal { position: fixed; inset: 0; z-index: 1000; }
.ah-modal[hidden] { display: none; }
.ah-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); }
.ah-modal-box {
	position: relative;
	background: var(--pico-background-color);
	max-width: 95vw;
	max-height: 90vh;
	margin: 4vh auto;
	padding: 1rem 1.25rem;
	border-radius: 0.6rem;
	display: flex;
	flex-direction: column;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
.ah-modal-close {
	position: absolute;
	top: 0.3rem;
	right: 0.5rem;
	width: auto;
	margin: 0;
	padding: 0.1rem 0.5rem;
	background: none;
	border: 0;
	font-size: 1.7rem;
	line-height: 1;
	color: var(--pico-muted-color);
	cursor: pointer;
}
.ah-modal-body { overflow: auto; }

.ah-head { display: flex; gap: 0.6rem; align-items: baseline; margin-bottom: 0.6rem; }
.ah-head strong { font-size: 1.1rem; }
.ah-scroll { overflow: auto; max-height: 72vh; }

.ah-table { border-collapse: collapse; font-size: 0.8rem; }
.ah-table th,
.ah-table td {
	border: 1px solid var(--pico-card-border-color);
	padding: 0.2rem 0.45rem;
	white-space: nowrap;
}
.ah-table .num { text-align: right; }
.ah-table thead th {
	position: sticky;
	background: var(--pico-card-sectioning-background-color);
	z-index: 2;
}
/* Двухрядная шапка: высота первого ряда зафиксирована, второй ряд прилипает
   ровно под ним. Первый ряд — «Неделя N» + дата в 2 строки. */
.ah-table thead tr:first-child th { top: 0; height: 44px; box-sizing: border-box; }
.ah-table thead tr:nth-child(2) th { top: 44px; }
.ah-sticky {
	position: sticky;
	left: 0;
	background: var(--pico-card-background-color);
	z-index: 3;
	text-align: left;
}
.ah-table thead .ah-sticky { z-index: 4; }
.ah-week { text-align: center; }
.ah-week small { display: block; font-weight: normal; color: var(--pico-muted-color); }
.ah-wk-start { border-left: 2px solid var(--pico-muted-color); }
.ah-dow { font-weight: 600; }
.ah-future {
	background: repeating-linear-gradient(45deg, #f3f3f3, #f3f3f3 4px, #fff 4px, #fff 8px);
}
.ah-total td,
.ah-total th { background: #eef3fb; }
.ah-sub td,
.ah-sub th { background: #f4f4f4; color: var(--pico-muted-color); }
.ah-stock td,
.ah-stock th { background: #fffbe6; }
.ah-turn td,
.ah-turn th { background: #fdeee6; }
.ah-note { margin-top: 0.5rem; color: var(--pico-muted-color); }
.ah-loading { padding: 2rem; text-align: center; color: var(--pico-muted-color); }

/* === Сводная по группам === */
/* Скоркард по менеджерам — сводка вверху страницы Сводной */
.mgr-scorecard { margin: 0.8rem 0 1.6rem; overflow-x: auto; }
.mgr-scorecard h3 { font-size: 0.95rem; margin: 0 0 0.5rem; }
.scorecard { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.scorecard th, .scorecard td {
	padding: 0.35rem 0.7rem;
	border: 1px solid var(--pico-card-border-color);
	white-space: nowrap;
}
.scorecard thead th { background: var(--pico-card-sectioning-background-color); text-align: left; }
.scorecard .num { text-align: right; }
.scorecard tbody tr:hover { background: var(--pico-card-sectioning-background-color); }
.scorecard a { text-decoration: none; }
.scorecard a:hover { text-decoration: underline; }
.scorecard-total th, .scorecard-total td {
	font-weight: 700;
	background: var(--pico-card-sectioning-background-color);
	border-top: 2px solid var(--pico-primary, #2563eb);
}
.scorecard thead th.sortable {
	cursor: pointer;
	user-select: none;
	position: relative;
	padding-right: 1.2rem;
}
.scorecard thead th.sortable:hover { background: #E5EFFA; }
.scorecard thead th.sortable::after {
	content: '⇅';
	position: absolute;
	right: 0.35rem;
	color: var(--pico-muted-color);
	opacity: 0.6;
	font-size: 0.75rem;
}
.scorecard thead th.sort-asc::after  { content: '▲'; color: var(--pico-primary, #2563eb); opacity: 1; }
.scorecard thead th.sort-desc::after { content: '▼'; color: var(--pico-primary, #2563eb); opacity: 1; }
/* Строка «без пользователя» — артикулы вне групп */
.scorecard-unassigned td:first-child { font-style: italic; color: var(--pico-muted-color); }

/* Алерт админам — карточки с выручкой вне всех групп */
.admin-alert {
	border: 1px solid #f0a8a8;
	background: #fdecec;
	border-left: 4px solid #dc2626;
	border-radius: 6px;
	padding: 0.8rem 1rem;
	margin: 0.8rem 0 1.4rem;
}
.admin-alert-head { font-weight: 700; color: #b91c1c; font-size: 0.95rem; margin-bottom: 0.3rem; }
.admin-alert p { margin: 0.3rem 0; font-size: 0.85rem; }
.admin-alert-table-wrap { max-height: 320px; overflow-y: auto; margin: 0.6rem 0; }
.admin-alert-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.admin-alert-table th, .admin-alert-table td {
	padding: 0.3rem 0.6rem;
	border: 1px solid #f0c8c8;
	white-space: nowrap;
}
.admin-alert-table thead th { background: #fbdcdc; text-align: left; position: sticky; top: 0; }
.admin-alert-table .num { text-align: right; }
.admin-alert-foot { font-size: 0.8rem; color: var(--pico-muted-color); }

.sum-section { margin-bottom: 1.5rem; }
.sum-table {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
	font-size: 0.78rem;
}
.sum-table th, .sum-table td {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.sum-table th,
.sum-table td {
	border: 1px solid var(--pico-card-border-color);
	padding: 0.3rem 0.6rem;
}
.sum-table thead th {
	background: var(--pico-card-sectioning-background-color);
	text-align: left;
	font-size: 0.78rem;
}
.sum-table .num { text-align: right; }
.sum-table tbody tr:hover { background: var(--pico-card-sectioning-background-color); }
.sum-table a { text-decoration: none; }
.sum-table a:hover { text-decoration: underline; }
.warn-link { color: #e8540c; }

.sum-subtotal th,
.sum-subtotal td {
	background: var(--pico-card-sectioning-background-color);
	font-weight: 600;
	border-top: 2px solid var(--rnp, var(--pico-muted-color));
}
.sum-grand { margin-top: 0.5rem; }
/* Сводная: секции и строка «Итого» текут по странице, без вложенных
   скролл-боксов. Иначе у длинной секции появляется вертикальный скроллбар,
   её таблица сужается — и нижняя строка «Итого» не совпадает по колонкам. */
.sum-section .table-wrap,
.sum-grand .table-wrap {
	position: static;
	max-height: none;
	overflow: visible;
}
.sum-grand-row th,
.sum-grand-row td {
	background: #1f3a5f;
	color: #fff;
	font-weight: 700;
	font-size: 0.9rem;
	padding: 0.45rem 0.6rem;
	border: 1px solid #1f3a5f;
}
.sum-grand-row .pp-negative { color: #ff9b9b; }
.sum-grand-row .pp-positive { color: #9be79b; }
/* Блоки колонок «Продажи» / «Заказы» */
.sum-table .blk-sales  { background: rgba(37, 99, 235, 0.10); text-align: center; }
.sum-table .blk-orders { background: rgba(234, 88, 12, 0.10); text-align: center; }
.sum-table .blk-start  { border-left: 2px solid var(--pico-muted-color); }
.sum-period {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem 1.2rem;
	margin: 0.25rem 0 1rem;
	font-size: 0.82rem;
	color: var(--pico-muted-color);
}

/* Переключатель периода 7/14/30 */
.period-switch {
	display: inline-flex;
	gap: 0;
	margin: 0.5rem 0;
	border: 1px solid var(--pico-card-border-color);
	border-radius: 0.4rem;
	overflow: hidden;
}
.period-switch a {
	padding: 0.35rem 0.9rem;
	font-size: 0.85rem;
	text-decoration: none;
	color: var(--pico-color);
	border-right: 1px solid var(--pico-card-border-color);
}
.period-switch a:last-child { border-right: 0; }
.period-switch a:hover { background: var(--pico-card-sectioning-background-color); }
.period-switch a.active {
	background: var(--pico-primary, #2563eb);
	color: #fff;
	font-weight: 600;
}

/* «Свой период» — кнопка-поповер рядом с переключателем 7/14/30 */
.period-row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
	margin: 0.5rem 0;
}
.period-row .period-switch { margin: 0; }
.period-pop {
	position: relative;
	display: inline-block;
}
.period-pop > summary {
	list-style: none;
	cursor: pointer;
	user-select: none;
	padding: 0.35rem 0.9rem;
	font-size: 0.85rem;
	border: 1px solid var(--pico-card-border-color);
	border-radius: 0.4rem;
	white-space: nowrap;
}
.period-pop > summary::-webkit-details-marker { display: none; }
.period-pop > summary:hover { background: var(--pico-card-sectioning-background-color); }
.period-pop[open] > summary { background: var(--pico-card-sectioning-background-color); }
.period-pop > summary.active {
	background: var(--pico-primary, #2563eb);
	color: #fff;
	font-weight: 600;
}

/* «Свой период» как последняя секция полоски 7/14/30 — в одну линию.
   overflow:visible, чтобы поповер-календарь не обрезался рамкой бара. */
.period-switch--pop { overflow: visible; }
.period-switch--pop > a:first-child {
	border-top-left-radius: 0.4rem;
	border-bottom-left-radius: 0.4rem;
}
.period-switch--pop .period-pop {
	position: relative;
	display: flex;
}
.period-switch--pop .period-pop > summary {
	border: 0;                       /* разделитель даёт border-right соседней ссылки */
	border-radius: 0 0.4rem 0.4rem 0;
}
.period-pop-menu {
	position: absolute;
	z-index: 50;
	top: calc(100% + 0.3rem);
	left: 0;
	min-width: 240px;
	padding: 0.7rem 0.75rem;
	background: var(--pico-card-background-color, #fff);
	border: 1px solid var(--pico-card-border-color);
	border-radius: 0.5rem;
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
}
.period-pop-menu form {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin: 0;
}
.period-pop-menu .hint {
	font-size: 0.78rem;
	opacity: 0.55;
	text-align: center;
}

/* Мини-календарь выбора диапазона внутри поповера.
   Селекторы скоупим под .period-pop-menu, чтобы перебить кнопочные
   стили Pico (иначе текст дней наследует белый цвет и не виден). */
.rcal { user-select: none; }
.rcal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.4rem;
}
.rcal-title { font-size: 0.88rem; font-weight: 600; }
.period-pop-menu .rcal-nav {
	width: 1.8rem;
	height: 1.8rem;
	min-width: 0;
	padding: 0;
	margin: 0;
	line-height: 1;
	font-size: 1.1rem;
	border: 1px solid var(--pico-card-border-color);
	border-radius: 6px;
	background: transparent;
	color: var(--text, #18181b);
	cursor: pointer;
}
.period-pop-menu .rcal-nav:hover { background: var(--pico-card-sectioning-background-color, #f0f0f3); }
.rcal-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 2px;
}
.rcal-wd {
	text-align: center;
	font-size: 0.7rem;
	opacity: 0.5;
	padding-bottom: 0.2rem;
}
.rcal-empty { aspect-ratio: 1; }
.period-pop-menu .rcal-day {
	aspect-ratio: 1;
	width: 100%;
	min-width: 0;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	color: var(--text, #18181b);
	font-size: 0.8rem;
	font-weight: 400;
	cursor: pointer;
}
.period-pop-menu .rcal-day:hover { background: var(--pico-card-sectioning-background-color, #f0f0f3); }
.period-pop-menu .rcal-day.in-range {
	background: rgba(37, 99, 235, 0.16);
	background: color-mix(in srgb, var(--pico-primary, #2563eb) 18%, transparent);
	border-radius: 0;
}
.period-pop-menu .rcal-day.range-start { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.period-pop-menu .rcal-day.range-end { border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
.period-pop-menu .rcal-day.range-start,
.period-pop-menu .rcal-day.range-end {
	background: var(--pico-primary, #2563eb);
	color: #fff;
	font-weight: 600;
}
.rcal-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.6rem;
	margin-top: 0.55rem;
}
.rcal-sel { font-size: 0.8rem; opacity: 0.8; }
.period-pop-menu button {
	padding: 0.4rem 0.9rem;
	border-radius: 6px;
	font-size: 0.85rem;
	font-weight: 600;
	margin: 0;
	width: auto;
	white-space: nowrap;
}

/* Маркер «есть комментарий» в drill-down — уголок (ячейки узкие, кнопка не влезает) */
.ah-table td.ah-has-cmt {
	position: relative;
	cursor: pointer;
}
.ah-table td.ah-has-cmt::after {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	border: 5px solid transparent;
	border-top-color: #e8540c;
	border-right-color: #e8540c;
}
.ah-table td.ah-has-cmt:hover { outline: 1px solid #e8540c; }
/* Сегодняшняя ячейка — редактируемый комментарий */
.ah-table td.ah-cmt-today {
	cursor: pointer;
	box-shadow: inset 0 0 0 2px var(--pico-primary, #2563eb);
}

/* Топ-10 убыточных по ОП — таблица на дашборде */
.loss-table {
	border-collapse: collapse;
	font-size: 0.9rem;
	margin-top: 0.5rem;
}
.loss-table th,
.loss-table td {
	border: 1px solid var(--pico-card-border-color);
	padding: 0.35rem 0.7rem;
	text-align: left;
}
.loss-table .num { text-align: right; }
.loss-table thead th { background: var(--pico-card-sectioning-background-color); }

/* Липкая шапка для Ozon-таблиц без #daily-table (поставки, распродажа,
   залежавшиеся) — чтобы при прокрутке вниз были видны названия колонок.
   z-index выше строк; фон непрозрачный, чтобы строки не просвечивали. */
.sticky-head thead th {
	position: sticky;
	top: 0;
	z-index: 6;
	background: var(--pico-card-sectioning-background-color);
	box-shadow: inset 0 -1px 0 var(--pico-card-border-color);
}
.loss-table tbody tr:hover { background: var(--pico-card-sectioning-background-color); }
.loss-table .pp-negative { color: #c62828; }

/* Новинка — строка подсвечена, бейдж после номера артикула */
.loss-table tbody tr.loss-new { background: #e7f2fd; }
.loss-table tbody tr.loss-new:hover { background: #d8e9fb; }
.new-badge {
	display: inline-block;
	margin-left: 0.25rem;
	padding: 0.02rem 0.24rem;
	font-size: 0.5rem;
	font-weight: 700;
	line-height: 1.3;
	color: #1d4ed8;
	background: #dbeafe;
	border: 1px solid #bfdbfe;
	border-radius: 999px;
	white-space: nowrap;
	vertical-align: middle;
}
[data-theme="dark"] .new-badge {
	color: #bfdbfe;
	background: rgba(37, 99, 235, 0.25);
	border-color: rgba(96, 165, 250, 0.45);
}

/* Статус «онлайн» в списке пользователей (админка) */
.users-online-line { font-size: 0.85rem; color: var(--pico-muted-color); margin: 0.2rem 0 0.8rem; }
.online-dot { color: #16a34a; font-weight: 600; white-space: nowrap; }
.offline-text { color: var(--pico-muted-color); }

.chart-period { font-weight: 400; font-size: 0.78rem; color: var(--pico-muted-color); }

.op-note {
	background: #eef3fb;
	border-left: 3px solid var(--pico-primary, #2563eb);
	padding: 0.5rem 0.8rem;
	margin: 0.6rem 0;
	font-size: 0.82rem;
	line-height: 1.5;
	color: var(--pico-color);
	border-radius: 0 4px 4px 0;
}

.loss-table tfoot .loss-total th {
	background: #eef3fb;
	font-weight: 600;
	border-top: 2px solid var(--pico-primary, #2563eb);
}

.period-switch-sep { display: inline-block; width: 1px; height: 1rem; background: var(--pico-card-border-color); margin: 0 0.4rem; vertical-align: middle; }

/* Фильтры над таблицей убыточных */
.dash-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.7rem 1.5rem;
	margin: 0.5rem 0 0.8rem;
}
.filter-group {
	display: flex;
	align-items: center;
	gap: 0.45rem;
}
.filter-label {
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--pico-muted-color);
}
.table-hint {
	font-size: 0.82rem;
	color: var(--pico-muted-color);
	margin: 0.7rem 0 0.4rem;
	line-height: 1.7;
}
.table-hint .new-badge { margin-left: 0; }
.loss-kpi { grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); }
.manager-select {
	font-size: 0.85rem;
	padding: 0.35rem 0.6rem;
	margin: 0;
	width: auto;
	min-width: 11rem;
	border-radius: 0.4rem;
}
.pool-badge {
	font-size: 0.85rem;
	padding: 0.35rem 0.7rem;
	background: var(--pico-card-sectioning-background-color);
	border: 1px solid var(--pico-card-border-color);
	border-radius: 0.4rem;
	color: var(--pico-muted-color);
}
.pool-badge b { color: var(--pico-color); }

/* Сортировка столбцов таблицы убыточных */
.loss-table thead th.sortable {
	cursor: pointer;
	user-select: none;
	position: relative;
	padding-right: 1.3rem;
}
.loss-table thead th.sortable:hover { background: #E5EFFA; }
.loss-table thead th.sortable::after {
	content: '⇅';
	position: absolute;
	right: 0.45rem;
	color: var(--pico-muted-color);
	opacity: 0.6;
	font-size: 0.8rem;
}
.loss-table thead th.sort-asc::after  { content: '▲'; color: var(--pico-primary, #2563eb); opacity: 1; }
.loss-table thead th.sort-desc::after { content: '▼'; color: var(--pico-primary, #2563eb); opacity: 1; }

/* ===== «На вывод» — пометка артикула на снятие с продажи ===== */
/* Подсветка row-withdraw убрана: артикулы «на вывод» теперь видны только
   во вкладке Withdraw, где подсветка каждой строки лишена смысла (все они
   withdraw). На Daily/OP/Сводной их вообще нет. Бейдж 🗑 остаётся. */

/* Ozon: «на вывод» — тусклый жёлтый фон строки (на /ozon/supplies и в
   group daily/weekly). Перебивает зебру/ds-bg/sticky. (Отдельный класс
   row-out — ВБ-овский row-withdraw убран, его не трогаем.) */
tr.row-out td, tr.row-out th { background-color: #fbf1c7 !important; }
tr.row-out:hover td, tr.row-out:hover th { background-color: #f6e7a0 !important; }

/* Бейдж «🗑 на вывод» — компактный, рядом с new-badge и т.п. */
.withdraw-badge {
	display: inline-block;
	margin-left: 0.25rem;
	padding: 0.02rem 0.32rem;
	font-size: 0.55rem;
	font-weight: 700;
	line-height: 1.4;
	color: #92400e;
	background: #fde68a;
	border: 1px solid #f59e0b;
	border-radius: 999px;
	white-space: nowrap;
	vertical-align: middle;
	text-decoration: none;
}
.withdraw-badge:hover { background: #fcd34d; color: #78350f; }
[data-theme="dark"] .withdraw-badge {
	color: #fcd34d;
	background: rgba(217, 119, 6, 0.25);
	border-color: rgba(245, 158, 11, 0.55);
}

/* Вкладка «🗑 На вывод» — оранжевый акцент */
.group-tabs a.tab-withdraw {
	color: #b45309;
}
.group-tabs a.tab-withdraw.active {
	color: #92400e;
	border-bottom-color: #d97706;
}
[data-theme="dark"] .group-tabs a.tab-withdraw { color: #fbbf24; }

/* Вкладка «🚫 Исключённые» — красный акцент, как у На вывод */
.group-tabs a.tab-excluded {
	color: #b91c1c;
}
.group-tabs a.tab-excluded.active {
	color: #7f1d1d;
	border-bottom-color: #dc2626;
}
[data-theme="dark"] .group-tabs a.tab-excluded { color: #f87171; }

/* Строка Сводной с пометками — лёгкий жёлтый фон */
.sum-table tbody tr.row-has-withdraw td { background: #fffbeb; }
[data-theme="dark"] .sum-table tbody tr.row-has-withdraw td { background: rgba(217, 119, 6, 0.08); }

/* Метрика на карточке группы в /my-tables */
.metric-withdraw {
	color: #92400e;
	background: #fef3c7;
	border-radius: 4px;
	padding: 0 0.3rem;
}
[data-theme="dark"] .metric-withdraw {
	color: #fcd34d;
	background: rgba(217, 119, 6, 0.2);
}
.group-card-has-withdraw {
	border-left: 3px solid #d97706;
}

/* Чекбокс «на вывод» в настройках группы — крупная галочка, удобно нажимать */
.withdraw-cell {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	margin: 0;
}
.withdraw-cell input {
	margin: 0;
	width: 1.25rem;
	height: 1.25rem;
	accent-color: #d97706;
	cursor: pointer;
}

/* Результат поиска, помеченный «на вывод» */
.search-result.row-withdraw {
	background: #fef3c7;
	border-left: 3px solid #d97706;
	padding-left: 0.5rem;
	border-radius: 0 4px 4px 0;
}
[data-theme="dark"] .search-result.row-withdraw {
	background: rgba(217, 119, 6, 0.15);
}

/* Маркетплейс-метка в шапке: «Мобимания WB» или «Мобимания OZON».
   Разделитель уже есть как border-right на .brand. Цвета — фирменные:
   WB фуксия #CB11AB, Ozon синий #005BFF. */
/* .brand-wrap — wrapper чтобы flex-gap родителя (.app-topbar gap:1rem) не
   добавлял пробел между «Мобимания» и значком WB/OZON. Внутри них зазор
   контролируется только padding-right .brand + margin-left .brand-mp. */
.brand-wrap { display: flex; align-items: center; }
.brand-mp { font-weight: 700; letter-spacing: 0.04em; font-size: 1rem; margin-left: 0.5rem; }
.brand-mp-wb   { color: #CB11AB; }
.brand-mp-ozon { color: #005BFF; }

/* Блок «📈 Тренд запросов в WB» в модалке drill-history */
.ah-trends { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--pico-card-border-color); }
.ah-trends h4 { margin-bottom: 0.25rem; }
.ah-trends-hint { color: var(--pico-muted-color); margin-bottom: 0.75rem; }
.ah-trend-card { margin-bottom: 0.5rem; padding: 0.5rem 0.75rem; }
.ah-trend-card h5 { margin: 0 0 0.25rem 0; font-size: 0.9rem; font-weight: 600; }
.ah-trend-meta { color: var(--pico-muted-color); margin-bottom: 0.25rem; min-height: 1.2em; }
.ah-trend-wrap { position: relative; height: 200px; width: 100%; }
.ah-trend-wrap canvas { max-height: 200px; }

/* === row-highlighted: финальное переопределение ===
   row-withdraw имеет селектор `#X tbody tr.row-withdraw td` со специфичностью
   (1,2,1) и !important. Базовое `tr.row-highlighted td` (0,1,1) проигрывает.
   Здесь явно выигрываем по компонентам id+классы и по позиции в файле. */
#daily-table tbody tr.row-highlighted td,
#daily-table tbody tr.row-highlighted td.sticky-vc,
#daily-table tbody tr.row-highlighted td.pinned-day,
#op-pivot-table tbody tr.row-highlighted td,
#op-pivot-table tbody tr.row-highlighted td.sticky-vc,
#op-pivot-table tbody tr.row-highlighted td.pinned-week {
	background: #f3e5f5 !important;
}
#daily-table tbody tr.row-highlighted td.sticky-vc,
#op-pivot-table tbody tr.row-highlighted td.sticky-vc {
	background: #e1bee7 !important;
}

/* === /admin/problem-models === */
.problem-section { margin-bottom: 1.5rem; padding: 1rem 1.25rem; }
.problem-section header strong { font-size: 1.05rem; }
.problem-count {
	display: inline-block; margin-left: 0.5rem;
	padding: 0.1rem 0.6rem;
	background: #e05b5b; color: #fff;
	border-radius: 999px; font-size: 0.78rem; font-weight: 600;
}
.problem-empty { color: var(--pico-muted-color); font-style: italic; }
.problem-error { color: #c62828; }
.problem-table { font-size: 0.85rem; }
.problem-table th, .problem-table td { padding: 0.4rem 0.6rem; }
.problem-table tbody tr:hover td { background: var(--pico-card-sectioning-background-color); }
.problem-link {
	display: inline-block; padding: 0.15rem 0.5rem;
	background: var(--pico-primary); color: #fff !important;
	border-radius: 4px; font-size: 0.75rem; text-decoration: none;
	margin-right: 0.25rem;
}
.problem-link:hover { filter: brightness(0.9); color: #fff !important; }

/* Шапка раздела «Проблемные модели» с кнопкой обновить */
.problem-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.problem-refresh-btn {
	margin: 0; padding: 0.5rem 1rem;
	background: var(--pico-primary); color: #fff !important;
	border: none; border-radius: 6px; cursor: pointer;
	font-size: 0.9rem; font-weight: 500; white-space: nowrap;
}
.problem-refresh-btn:hover:not(:disabled) { filter: brightness(0.92); color: #fff !important; }
.problem-refresh-btn:disabled { opacity: 0.7; cursor: progress; }
