html, body {
  min-height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background-color: #020240;
  background-image: url('/img/1586714840 (1).jpg');
  background-attachment: fixed;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  color: #222222;
}
.site-footer {
    max-width: 1200px;
    margin: 10px auto 30px;
    padding: 0 12px;
}

.footer-content {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(6px);
    border-radius: var(--radius);
    padding: 12px 18px;
    text-align: center;         /* выравнивает текст ровно по центру */
    font-size: 12.5px;
    color: var(--text-muted);
}
/* Кнопка закрытия модалок bPopup */
.b-close {
  border-radius: 7px;
  color: #FFFFFF;
  cursor: pointer;
  display: block;
  font: normal normal 700 16px/24px Arial, sans-serif;
  height: 24px;
  width: 24px;
  position: absolute;
  right: 8px;
  top: 8px;
  text-align: center;
  text-decoration: none;
}

:root {
	--bg-body: #dbe4ee;
	--card-bg: rgba(245, 248, 252, 0.95);
	--card-border: #b8c8d9;
	--primary: #1d4ed8;
	--primary-hover: #1e40af;
	--accent-ruby: #be123c;
	--text-main: #0f172a;
	--text-muted: #475569;
	--success: #15803d;
	--danger: #b91c1c;
	--ctrl-bg: #e2e8f0;
	--ctrl-border: #cbd5e1;
	--radius: 10px;
}

body {
	background: #dbe4ee url("//saltymakov.ru/img/bg.jpg") repeat-y center top;
	background-size: cover;
	color: var(--text-main);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	margin: 0;
	padding: 0;
	line-height: 1.4;
}

a {
	color: var(--primary);
	text-decoration: none;
	transition: color 0.15s ease;
}
a:hover {
	color: var(--primary-hover);
	text-decoration: underline;
}

.modal-content {
	width: 90%;
	max-width: 880px; /* Было ~500px, расширяем под просторный график */
	background: #ffffff;
	border-radius: 12px;
	padding: 20px 24px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
	position: relative;
	box-sizing: border-box;
}

/* Холст графика (canvas) растягиваем на всю доступную ширину */
.modal-content canvas {
	width: 100% !important;
	height: auto !important;
	max-height: 420px;
}
#container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 10px 12px;
}

/* Верхняя панель навигации */
.top-nav {
	position: relative; /* Чтобы Руби позиционировалась строго от этой плашки */
	background: var(--card-bg);
	border: 1px solid var(--card-border);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	backdrop-filter: blur(8px);
	padding: 10px 16px;
	border-radius: var(--radius);
	margin-bottom: 14px;
	margin-top: 25px; /* Запас сверху под голову фигурки */
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	font-size: 14px;
	font-weight: 500;
}
.top-nav-links {
	display: flex;
	align-items: center;
	gap: 12px;
}
.top-nav-actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

/* Сетка товаров */
.cards-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(560px, 1fr));
	gap: 14px;
	margin-bottom: 10px;
}

/* Карточка товара */
.parent {
	background: var(--card-bg);
	border: 1px solid var(--card-border);
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
	backdrop-filter: blur(6px);
	border-radius: var(--radius);
	padding: 14px;
	display: grid;
	grid-template-columns: 150px 1fr;
	grid-template-rows: 1fr auto;
	column-gap: 16px;
	row-gap: 10px;
	box-sizing: border-box;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.parent:hover {
	border-color: #94a3b8;
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

/* Колонка 1: Превью товара */
.div1 {
	grid-area: 1 / 1 / 2 / 2;
	display: flex;
	justify-content: center;
	align-items: flex-start;
}
.div1 img {
	width: 150px;
	height: 150px;
	object-fit: contain;
	border-radius: 8px;
	background: #ffffff;
	border: 1px solid var(--card-border);
}

/* Колонка 2: Информация */
.div2 {
	grid-area: 1 / 2 / 2 / 3;
	font-size: 13px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	overflow: hidden;
}
.product-title {
	font-size: 14px;
	font-weight: 600;
	color: #0f172a;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.product-title a {
	color: #0f172a;
}
.product-title a:hover {
	color: var(--primary);
}
.product-code {
	color: var(--text-muted);
	font-size: 11.5px;
	font-weight: 500;
}
.price-block {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 8px;
	margin: 2px 0;
}
.price-current {
	font-size: 19px;
	font-weight: 700;
	color: #0f172a;
}
.price-old {
	font-size: 13.5px;
	color: #64748b;
	text-decoration: line-through;
}
.price-badge {
	font-size: 12px;
	font-weight: 700;
	padding: 2px 6px;
	border-radius: 4px;
}
.price-badge.down { background: #dcfce7; color: var(--success); }
.price-badge.up { background: #fee2e2; color: var(--danger); }

.price-stats-inline {
	font-size: 12.5px;
	color: var(--text-muted);
	line-height: 1.3;
}
.price-stats-inline b {
	color: #0f172a;
}

.date-info {
	font-size: 10.5px;
	color: #64748b;
	display: flex;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 4px;
	margin-top: 2px;
}
.date-info span {
	white-space: nowrap;
}
.date-info b {
	color: #334155;
	font-weight: 600;
}
/* Нижняя панель действий */
.div3 {
	grid-area: 2 / 1 / 3 / 3;
	border-top: 1px solid var(--card-border);
	padding-top: 8px;
	margin-top: 4px;
}
.div3 > div {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
}
.actions-group {
	display: flex;
	align-items: center;
	gap: 6px;
}

/* Кнопки и селекторы */
.btn-mini {
	display: inline-flex;
	align-items: center;
	padding: 4px 8px;
	background: #ffffff;
	border: 1px solid #cbd5e1;
	color: #1e293b;
	border-radius: 5px;
	font-size: 12px;
	font-weight: 500;
	transition: all 0.15s;
	cursor: pointer;
}
.btn-mini:hover {
	background: #f1f5f9;
	border-color: #94a3b8;
	text-decoration: none;
	color: var(--primary);
}
.btn-mini.danger {
	color: var(--danger);
	border-color: #fca5a5;
}
.btn-mini.danger:hover {
	background: #fee2e2;
}

select {
	font-size: 12.5px;
	padding: 3px 6px;
	border-radius: 5px;
	border: 1px solid #cbd5e1;
	background: #ffffff;
	color: #1e293b;
	outline: none;
}
.help-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #e2e8f0;
	border: 1px solid #cbd5e1;
	color: #475569;
	font-size: 11px;
	cursor: pointer;
	font-weight: bold;
}

.nowrap { white-space: nowrap; }

/* Модальные окна и таблицы */
.blok-center {
	border-radius: var(--radius);
	box-shadow: 0 10px 30px rgba(0,0,0,0.3);
	padding: 18px 22px;
	background: #ffffff !important;
	border: 1px solid #cbd5e1;
	color: #0f172a;
	box-sizing: border-box;
}
.b-close {
	position: absolute;
	right: 12px;
	top: 8px;
	cursor: pointer;
	font-size: 18px;
	color: #64748b;
}
/* Модалка графика и таблицы на ПК */
.popup-title {
    font-size: 17px;
    font-weight: bold;
    margin-bottom: 12px;
    color: #1e293b;
}

.popup-body p {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #64748b;
}

.popup-body ul {
    margin: 0;
    padding-left: 18px;
    font-size: 14px;
}

.popup-body li {
    margin-bottom: 8px;
}
#result.modal-chart-view {
	width: 90vw;
	max-width: 90vw;
}

/* Модалка с таблицей — компактная и аккуратная */
#result.modal-table-view {
	width: 90vw;
	max-width: 480px; /* Таблица сожмется до аккуратных 480px */
}
/* Внутренний контейнер под холст графика */
#result canvas {
	width: 100% !important;
	height: auto !important;
	max-height: 440px;
}

#r_data {
	max-height: 90vh;
	overflow-y: auto;
	overflow-x: hidden;
}
.div_tables {
	border: 1px solid #94a3b8;
	border-radius: 5px;
	width: fit-content;
}
.data_tab {
	margin: auto;
	width: fit-content;
}
.data_tabl {
	display: flex;
	justify-content: center;
	align-items: center;
}
.grid {
	display: grid;
	grid-template-columns: 180px 70px;
}
.grid > div {
	text-align: center;
	border-right: 1px solid #cbd5e1;
	border-bottom: 1px solid #cbd5e1;
	padding: 4px;
	font-size: 12px;
}
.grid > div:last-child {
	border-right-width: 0px;
}
.div_tables > div:last-child > div {
	border-bottom-width: 0px;
}
.grid.th {
	background-color: #e0e7ff;
	color: #1e1b4b;
	font-weight: 600;
}
.chart-responsive-box {
	height: 360px;
}
@media (max-width: 650px) {
#result.modal-chart-view,
	#result.modal-table-view {
		width: 96vw !important;
		max-width: 96vw !important;
		padding: 12px 10px;
	}
.chart-responsive-box {
		height: 250px !important;
	}

	#result.blok-center {
		padding: 12px 8px !important;
	}
#result canvas {
  max-height: 260px !important;
  height: 240px !important;
}

    /* Располагаем заголовок и кнопку "Показать/Скрыть" компактно */
#r_data {
  font-size: 12px;
}
    
    
#r_data .b-close {
  top: 6px;
  right: 8px;
}
#container {
		padding: 6px 8px 12px;
}
#result.blok-center {
		width: 96vw !important;
		max-width: 96vw !important;
		padding: 12px 10px;
	}
	.cards-grid {
		grid-template-columns: 1fr;
		gap: 10px;
	}

	.parent {
		grid-template-columns: 85px 1fr;
		padding: 10px;
		column-gap: 12px;
		row-gap: 8px;
	}

	.div1 img {
		width: 85px;
		height: 85px;
	}

	.product-title {
		font-size: 13.5px;
		line-height: 1.3;
	}

	.price-current {
		font-size: 17px;
	}

	.price-stats-inline {
		font-size: 12px;
	}

	.date-info {
		font-size: 10.5px;
		gap: 10px;
	}

	/* Разделяем нижнюю панель на 2 аккуратных этажа */
	.div3 {
		padding-top: 8px;
		margin-top: 4px;
	}

	.div3 > div {
		display: flex;
		flex-direction: column;
		gap: 6px;
	}

	/* Первый этаж: Кнопки на всю ширину */
	.div3 .actions-group:first-child {
		display: flex;
		justify-content: space-between;
		width: 100%;
		gap: 6px;
	}

	.div3 .actions-group:first-child .btn-mini {
		flex: 1;
		justify-content: center;
		padding: 5px 0 !important;
		font-size: 12px !important;
		height: 28px;
		box-sizing: border-box;
	}

	.div3 .actions-group:first-child .btn-mini.danger {
		flex: 0 0 34px; /* Кнопка удаления компактным квадратом */
	}

	/* Второй этаж: Категория и Алерт с комфортной шириной */
	.div3 .actions-group:last-child {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		gap: 6px;
	}

	.div3 .actions-group:last-child span[data-m] {
		flex: 1;
		display: flex;
	}

	.div3 .actions-group:last-child select.category {
		width: 100% !important;
		max-width: 100% !important;
		height: 28px;
		font-size: 12px !important;
		padding: 2px 6px !important;
	}

	select.alert {
		height: 28px;
		font-size: 12px !important;
		max-width: 70px !important;
		padding: 2px 6px !important;
	}

	.help-icon {
		width: 18px;
		height: 18px;
		font-size: 11px;
		flex-shrink: 0;
	}

	.ruby-link {
		width: 42px !important;
		height: 24px !important;
	}

	.ruby-logo {
		height: 52px !important;
		bottom: -10px !important;
		left: -4px !important;
	}

	/* Организация шапки в 2 ровных этажа */
	.top-nav {
		padding: 8px 10px;
		gap: 8px;
		display: flex;
		flex-direction: column;
		align-items: stretch;
		margin-top: 15px;
	}

	.top-nav-links {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		font-size: 12.5px;
	}

	.top-nav-actions {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 6px;
	}

	.top-nav-actions select {
		flex: 1;
		height: 28px;
		font-size: 12px !important;
	}

	.top-nav-actions .btn-mini {
		height: 28px;
		font-size: 12px !important;
		white-space: nowrap;
	}
	
}