/* Bảng Giá Excel – giao diện bảng giá.
 * Kế thừa font của theme. Đổi màu chủ đạo trong trang quản trị
 * hoặc ghi đè biến --bge-accent trong CSS của theme. */

.bge {
	--bge-accent: #1f6f5c;
	--bge-ink: #1d2327;
	--bge-muted: #5f6b73;
	--bge-line: #dde3e6;
	--bge-zebra: #f6f8f9;
	--bge-tint: #e8f1ee;
	--bge-mark: #ffe58a;
	--bge-radius: 6px;
	color: var(--bge-ink);
	margin: 1.5em 0;
	font-size: 15px;
	line-height: 1.45;
}
@supports (background: color-mix(in srgb, red 10%, white)) {
	.bge { --bge-tint: color-mix(in srgb, var(--bge-accent) 10%, #fff); }
}
.bge *,
.bge *::before,
.bge *::after { box-sizing: border-box; }
.bge [hidden] { display: none !important; }

/* Tiêu đề lấy từ các dòng phía trên bảng trong Excel */
.bge-heading { margin: 0 0 1em; }
.bge-heading p { margin: 0; }
.bge-heading__main { font-size: 1.35em; font-weight: 700; line-height: 1.25; }
.bge-heading .bge-heading__sub { color: var(--bge-muted); margin-top: .2em; }

/* Tab nhiều sheet */
.bge-tabs {
	display: flex;
	gap: 4px;
	overflow-x: auto;
	border-bottom: 2px solid var(--bge-line);
	margin-bottom: 1.25em;
}
.bge .bge-tab {
	appearance: none;
	background: none;
	border: 0;
	border-bottom: 2px solid transparent;
	border-radius: 0;
	margin: 0 0 -2px;
	padding: .6em 1em;
	font: inherit;
	font-weight: 600;
	color: var(--bge-muted);
	cursor: pointer;
	white-space: nowrap;
	text-transform: none;
	box-shadow: none;
}
.bge .bge-tab:hover { color: var(--bge-ink); background: none; }
.bge .bge-tab[aria-selected="true"] { color: var(--bge-accent); border-bottom-color: var(--bge-accent); }

/* Thanh tìm kiếm */
.bge-tools {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: .75em 1em;
	margin: 0 0 .9em;
}
.bge-field { display: flex; flex-direction: column; gap: .3em; margin: 0; }
.bge-field--q { flex: 1 1 260px; }
.bge-field--col { flex: 0 1 220px; }
.bge-label { font-size: .85em; font-weight: 600; color: var(--bge-muted); }
.bge-search { position: relative; display: block; }
.bge .bge-col,
.bge .bge-q {
	width: 100%;
	height: 42px;
	margin: 0;
	padding: 0 .8em;
	font: inherit;
	color: var(--bge-ink);
	background-color: #fff;
	border: 1px solid #c3ccd1;
	border-radius: var(--bge-radius);
	box-shadow: none;
}
.bge .bge-q { padding-right: 2.4em; }
.bge .bge-q::-webkit-search-cancel-button { display: none; }
.bge .bge-col:focus,
.bge .bge-q:focus {
	outline: none;
	border-color: var(--bge-accent);
	box-shadow: 0 0 0 3px var(--bge-tint);
}
.bge .bge-clear {
	position: absolute;
	right: 4px;
	top: 50%;
	transform: translateY(-50%);
	width: 34px;
	height: 34px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	color: var(--bge-muted);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}
.bge .bge-clear:hover { background: var(--bge-zebra); color: var(--bge-ink); }
.bge-count {
	margin: 0 0 0 auto;
	padding-bottom: .6em;
	font-size: .9em;
	color: var(--bge-muted);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* Bảng */
.bge-scroll {
	overflow: auto;
	border: 1px solid var(--bge-line);
	border-radius: var(--bge-radius);
	background: #fff;
}
.bge-scroll:focus-visible { outline: 2px solid var(--bge-accent); outline-offset: 2px; }
.bge .bge-table {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: separate;
	border-spacing: 0;
	font-size: inherit;
}
.bge .bge-table th,
.bge .bge-table td {
	padding: .65em .9em;
	border: 0;
	border-bottom: 1px solid var(--bge-line);
	text-align: left;
	vertical-align: top;
	background: transparent;
}
.bge .bge-table thead th {
	position: sticky;
	top: 0;
	z-index: 2;
	padding: 0;
	border-bottom: 0;
	background: var(--bge-accent);
	color: #fff;
	font-weight: 600;
	white-space: nowrap;
}
.bge .bge-sort {
	all: unset;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	gap: .5em;
	width: 100%;
	padding: .75em .9em;
	cursor: pointer;
}
.bge .bge-table thead th.bge-num .bge-sort { justify-content: flex-end; }
.bge .bge-sort:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.bge-sort i {
	width: 0;
	height: 0;
	border: 4px solid transparent;
	border-top-color: currentColor;
	margin-top: 4px;
	opacity: .35;
}
.bge [aria-sort="ascending"] .bge-sort i { border-top-color: transparent; border-bottom-color: currentColor; margin: -4px 0 0; opacity: 1; }
.bge [aria-sort="descending"] .bge-sort i { opacity: 1; }

.bge .bge-table tbody tr:nth-child(even) td { background: var(--bge-zebra); }
.bge .bge-table tbody tr:hover td { background: var(--bge-tint); }
.bge .bge-table tbody tr:last-child td { border-bottom: 0; }
.bge .bge-table td.bge-num {
	text-align: right;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}
.bge .bge-table tr.bge-group th {
	background: var(--bge-tint);
	color: var(--bge-ink);
	font-weight: 700;
	border-left: 4px solid var(--bge-accent);
	padding-top: .8em;
	padding-bottom: .8em;
}
.bge mark {
	background: var(--bge-mark);
	color: inherit;
	padding: 0 1px;
	border-radius: 2px;
}
.bge .bge-table.is-empty thead { display: none; }
.bge-empty { margin: 0; padding: 2em 1em; text-align: center; color: var(--bge-muted); }

/* Phân trang */
.bge-pager {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 4px;
	margin-top: 1em;
}
.bge .bge-page {
	min-width: 38px;
	height: 38px;
	min-height: 0;
	margin: 0;
	padding: 0 .6em;
	font: inherit;
	font-variant-numeric: tabular-nums;
	color: var(--bge-ink);
	background: #fff;
	border: 1px solid var(--bge-line);
	border-radius: var(--bge-radius);
	cursor: pointer;
	text-transform: none;
	box-shadow: none;
}
.bge .bge-page:hover:not([disabled]) { border-color: var(--bge-accent); color: var(--bge-accent); }
.bge .bge-page[aria-current="page"] { background: var(--bge-accent); border-color: var(--bge-accent); color: #fff; }
.bge .bge-page[disabled] { opacity: .4; cursor: default; }
.bge .bge-page:focus-visible { outline: 2px solid var(--bge-accent); outline-offset: 2px; }
.bge-gap { padding: 0 .3em; color: var(--bge-muted); }

.bge-download {
	display: flex;
	flex-wrap: wrap;
	gap: .5em 1.25em;
	align-items: baseline;
	margin: 1.25em 0 0;
	font-size: .92em;
}
.bge-download a { color: var(--bge-accent); font-weight: 600; }
.bge-updated { color: var(--bge-muted); }

/* Điện thoại */
@media (max-width: 640px) {
	.bge-field--col,
	.bge-field--q { flex: 1 1 100%; }
	.bge-count { margin-left: 0; padding-bottom: 0; }

	/* Kiểu thẻ: mỗi dòng thành một khối */
	.bge--stack .bge-scroll { max-height: none; border: 0; background: none; overflow: visible; }
	.bge--stack .bge-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
	.bge--stack .bge-table,
	.bge--stack .bge-table tbody,
	.bge--stack .bge-table tr,
	.bge--stack .bge-table td,
	.bge--stack .bge-table tr.bge-group th { display: block; width: 100%; }
	.bge--stack .bge-table tbody tr:not(.bge-group) {
		margin-bottom: .75em;
		border: 1px solid var(--bge-line);
		border-radius: var(--bge-radius);
		overflow: hidden;
		background: #fff;
	}
	.bge--stack .bge-table tr.bge-group th { margin: 1em 0 .6em; border-radius: var(--bge-radius); }
	.bge.bge--stack .bge-table tbody tr td { background: #fff; }
	.bge.bge--stack .bge-table td {
		display: grid;
		grid-template-columns: minmax(90px, 38%) 1fr;
		gap: .75em;
		text-align: left;
		white-space: normal;
	}
	.bge--stack .bge-table td::before {
		content: attr(data-label);
		font-weight: 600;
		color: var(--bge-muted);
	}
	.bge--stack .bge-table td[data-empty] { display: none; }
	.bge.bge--stack .bge-table tbody tr td:last-child { border-bottom: 0; }
}
