:root {
	--bg: #f5f7f8;
	--surface: #ffffff;
	--surface-2: #eef3f1;
	--text: #17201b;
	--muted: #5f6b64;
	--line: #d9e0dc;
	--primary: #1f7a4d;
	--primary-dark: #155b39;
	--accent: #b15c1b;
	--danger: #b3261e;
	--radius: 8px;
	--shadow: 0 10px 30px rgba(23, 32, 27, 0.08);
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	color: var(--text);
	background: var(--bg);
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	min-height: 100vh;
	background: var(--bg);
	color: var(--text);
}

body.has-lightbox {
	overflow: hidden;
}

a {
	color: var(--primary-dark);
}

img {
	max-width: 100%;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.topbar {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
	padding: 14px 22px;
	border-bottom: 1px solid var(--line);
	background: rgba(255, 255, 255, 0.96);
	backdrop-filter: blur(10px);
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-weight: 700;
}

.brand-mark {
	display: inline-grid;
	place-items: center;
	width: 40px;
	height: 32px;
	border-radius: 6px;
	background: var(--primary);
	color: #fff;
	font-size: 13px;
	letter-spacing: 0;
}

.nav {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.nav a {
	padding: 8px 10px;
	border-radius: 6px;
	color: var(--text);
	text-decoration: none;
	font-size: 14px;
}

.nav a:hover,
.nav a:focus {
	background: var(--surface-2);
	outline: none;
}

.shell {
	width: min(1480px, calc(100% - 32px));
	margin: 24px auto 44px;
}

.page-head {
	display: flex;
	align-items: end;
	justify-content: space-between;
	gap: 18px;
	margin: 0 0 18px;
}

h1,
h2 {
	margin: 0;
	letter-spacing: 0;
	line-height: 1.15;
}

h1 {
	font-size: 28px;
}

h2 {
	font-size: 18px;
}

p {
	margin: 8px 0 0;
	color: var(--muted);
}

.auth-panel,
.panel,
.empty-state {
	max-width: 760px;
	padding: 24px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
	box-shadow: var(--shadow);
}

.auth-panel {
	max-width: 430px;
	margin: 8vh auto 0;
}

.stack {
	display: grid;
	gap: 16px;
	margin-top: 20px;
}

label {
	display: grid;
	gap: 7px;
	font-weight: 650;
	font-size: 14px;
}

label span {
	color: var(--text);
}

input,
select {
	width: 100%;
	min-height: 40px;
	padding: 9px 11px;
	border: 1px solid #c8d2cd;
	border-radius: 6px;
	background: #fff;
	color: var(--text);
	font: inherit;
}

input:focus,
select:focus {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.15);
	outline: none;
}

.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 9px 14px;
	border: 1px solid transparent;
	border-radius: 6px;
	font: inherit;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
	white-space: nowrap;
}

.button.primary {
	background: var(--primary);
	color: #fff;
}

.button.primary:hover,
.button.primary:focus {
	background: var(--primary-dark);
}

.button.secondary {
	border-color: var(--line);
	background: #fff;
	color: var(--text);
}

.button.secondary:hover,
.button.secondary:focus {
	border-color: #b5c2bc;
	background: var(--surface-2);
}

.alert {
	margin-bottom: 16px;
	padding: 12px 14px;
	border-radius: 6px;
	border: 1px solid var(--line);
	background: #fff;
	font-weight: 650;
}

.alert-success {
	border-color: rgba(31, 122, 77, 0.35);
	background: #eaf6ef;
	color: #155b39;
}

.alert-error {
	border-color: rgba(179, 38, 30, 0.35);
	background: #fff0ee;
	color: var(--danger);
}

.filters {
	display: grid;
	grid-template-columns: minmax(220px, 1fr) minmax(190px, 260px) minmax(180px, 220px) minmax(140px, 170px) auto;
	align-items: end;
	gap: 12px;
	margin-bottom: 16px;
	padding: 14px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
}

.size-filter {
	grid-column: 1 / -1;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 12px;
	border: 1px solid var(--line);
	border-radius: 6px;
}

.size-filter legend {
	padding: 0 6px;
	color: var(--muted);
	font-size: 13px;
	font-weight: 700;
}

.size-filter label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 32px;
	padding: 5px 8px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: #fff;
	font-weight: 700;
}

.size-filter input {
	width: 16px;
	min-height: 16px;
}

.table-wrap {
	overflow-x: auto;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
}

table {
	width: 100%;
	border-collapse: collapse;
}

th,
td {
	padding: 12px;
	border-bottom: 1px solid var(--line);
	text-align: left;
	vertical-align: top;
}

th {
	background: #f0f4f2;
	font-size: 13px;
	color: #33443a;
}

tbody tr:last-child td {
	border-bottom: 0;
}

.sku-table th:first-child,
.image-cell {
	width: 168px;
}

.sku-table th:nth-child(2),
.product-cell {
	width: 300px;
}

.image-cell img,
.no-image {
	width: 148px;
	height: 148px;
	border-radius: 6px;
	object-fit: contain;
	border: 1px solid var(--line);
	background: #fff;
}

.image-zoom-trigger {
	display: inline-flex;
	width: 148px;
	height: 148px;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: transparent;
	cursor: zoom-in;
}

.image-zoom-trigger:focus-visible {
	outline: 3px solid rgba(31, 122, 77, 0.35);
	outline-offset: 3px;
}

.image-zoom-trigger:hover img,
.image-zoom-trigger:focus-visible img {
	border-color: var(--primary);
}

.no-image {
	display: grid;
	place-items: center;
	padding: 10px;
	color: var(--muted);
	font-size: 12px;
	text-align: center;
}

.product-name {
	font-weight: 750;
	line-height: 1.25;
}

.meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 8px;
}

.meta span {
	padding: 4px 7px;
	border-radius: 6px;
	background: var(--surface-2);
	color: var(--muted);
	font-size: 12px;
}

.product-link {
	display: inline-flex;
	margin-top: 10px;
	font-size: 13px;
	font-weight: 750;
	text-decoration: none;
}

.product-link:hover,
.product-link:focus {
	text-decoration: underline;
}

.muted {
	color: var(--muted);
	font-size: 14px;
}

.sizes-cell {
	min-width: 420px;
}

.size-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 10px;
}

.size-input {
	display: grid;
	gap: 5px;
	padding: 8px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: #fff;
	font-size: 12px;
}

.size-label {
	font-weight: 800;
	color: var(--text);
}

.size-input input {
	min-height: 42px;
	padding: 16px 9px 5px;
	font-size: 14px;
}

.floating-input {
	position: relative;
	display: block;
	gap: 0;
	font-size: 12px;
}

.floating-input span {
	position: absolute;
	top: 50%;
	left: 10px;
	padding: 0 3px;
	background: #fff;
	color: var(--muted);
	font-size: 13px;
	font-weight: 650;
	line-height: 1;
	pointer-events: none;
	transform: translateY(-50%);
	transition: top 0.14s ease, font-size 0.14s ease, color 0.14s ease, transform 0.14s ease;
}

.floating-input input:focus + span,
.floating-input input:not(:placeholder-shown) + span {
	top: 7px;
	color: var(--primary-dark);
	font-size: 10px;
	transform: translateY(0);
}

.size-input input.is-pending,
.size-input input.is-saving {
	border-color: var(--accent);
}

.size-input input.is-saved {
	border-color: rgba(31, 122, 77, 0.55);
}

.size-input input.is-error {
	border-color: var(--danger);
	background: #fff7f6;
}

.field-save-state {
	min-height: 14px;
	color: var(--muted);
	font-size: 11px;
	line-height: 1.2;
}

.sticky-actions {
	position: sticky;
	bottom: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 12px;
	padding: 12px 14px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: rgba(255, 255, 255, 0.96);
	box-shadow: var(--shadow);
	color: var(--muted);
}

.autosave-status {
	padding: 5px 8px;
	border-radius: 6px;
	background: var(--surface-2);
	color: var(--muted);
	font-size: 13px;
	font-weight: 700;
}

.autosave-status.is-saving {
	background: #fff7ed;
	color: #6a3a13;
}

.autosave-status.is-saved {
	background: #eaf6ef;
	color: #155b39;
}

.autosave-status.is-error {
	background: #fff0ee;
	color: var(--danger);
}

.pagination {
	display: flex;
	gap: 10px;
	margin-top: 14px;
}

.check-row {
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 600;
}

.check-row input {
	width: 18px;
	min-height: 18px;
}

.hint {
	padding: 12px;
	border-left: 4px solid var(--accent);
	background: #fff7ed;
	color: #6a3a13;
	font-size: 14px;
	line-height: 1.45;
}

.user-form {
	display: grid;
	grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(160px, 220px) auto;
	align-items: end;
	gap: 12px;
	margin-top: 16px;
}

.users-table td {
	vertical-align: middle;
}

.inline-form {
	display: flex;
	align-items: center;
	gap: 8px;
}

.inline-form input {
	min-width: 170px;
}

.image-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(11, 15, 13, 0.78);
}

.image-lightbox.is-open {
	display: flex;
}

.image-lightbox-panel {
	position: relative;
	display: grid;
	gap: 10px;
	width: min(920px, 100%);
	max-height: calc(100vh - 48px);
	padding: 14px;
	border-radius: var(--radius);
	background: #fff;
	box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.image-lightbox-panel img {
	width: 100%;
	max-height: calc(100vh - 150px);
	object-fit: contain;
	background: #fff;
}

.image-lightbox-title {
	margin: 0;
	color: var(--text);
	font-weight: 750;
}

.image-lightbox-close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 38px;
	height: 38px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: #fff;
	color: var(--text);
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

@media (max-width: 820px) {
	.topbar,
	.page-head,
	.sticky-actions {
		align-items: stretch;
		flex-direction: column;
	}

	.shell {
		width: min(100% - 20px, 1480px);
		margin-top: 14px;
	}

	.filters,
	.user-form {
		grid-template-columns: 1fr;
	}

	.sku-table,
	.sku-table thead,
	.sku-table tbody,
	.sku-table tr,
	.sku-table th,
	.sku-table td {
		display: block;
		width: 100%;
	}

	.sku-table thead {
		display: none;
	}

	.sku-table tr {
		border-bottom: 1px solid var(--line);
	}

	.image-cell,
	.product-cell,
	.sizes-cell {
		border-bottom: 0;
	}

	.size-grid {
		grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
	}

	.inline-form {
		align-items: stretch;
		flex-direction: column;
	}
}
