:root {
	--bg: #070a06;
	--panel: #fffdf8;
	--panel-soft: #f8f5ee;
	--line: #cfc6b7;
	--text: #26231f;
	--muted: #6c6257;
	--toxic: #a7ff16;
	--toxic-2: #69c900;
	--gold: #d7b456;
	--green: #2f6f58;
	--blue: #0b5a79;
	--amber: #8a6418;
	--red: #9d3434;
	--shadow: 0 12px 34px rgba(0, 0, 0, 0.18);
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background:
		radial-gradient(circle at 18% 0%, rgba(167, 255, 22, 0.14), transparent 26%),
		linear-gradient(180deg, #070a06 0, #101409 250px, #f3f0e8 251px);
	color: var(--text);
	font-family: Arial, Helvetica, sans-serif;
	font-size: 14px;
	line-height: 1.35;
}

a {
	color: inherit;
	text-decoration: none;
}

h1,
h2,
p {
	margin: 0;
}

h1 {
	color: #f4f7e8;
	font-size: 24px;
	font-weight: 800;
}

h2 {
	font-size: 16px;
	font-weight: 800;
}

.topbar {
	display: grid;
	grid-template-columns: auto minmax(220px, 1fr) auto;
	align-items: center;
	gap: 18px;
	padding: 18px clamp(12px, 3vw, 28px);
	border-bottom: 1px solid rgba(167, 255, 22, 0.24);
	color: #f4f7e8;
}

.brand-mini,
.top-actions {
	display: flex;
	align-items: center;
	gap: 10px;
}

.brand-mini strong,
.brand-mini small {
	display: block;
	line-height: 1.05;
}

.brand-mini small {
	margin-top: 3px;
	color: var(--toxic);
	font-size: 11px;
	font-weight: 800;
	text-transform: uppercase;
}

.brand-mark {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border: 1px solid #ddff72;
	border-radius: 8px;
	background: linear-gradient(135deg, var(--toxic), #d7ff66);
	color: #081003;
	font-weight: 900;
	box-shadow: 0 0 24px rgba(167, 255, 22, 0.34);
}

.page-title p {
	margin-top: 4px;
	color: #cbd6b1;
}

.language-select {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: #cbd6b1;
	font-size: 12px;
	font-weight: 800;
}

.language-select select {
	min-height: 36px;
	padding: 0 9px;
	border: 1px solid rgba(215, 180, 86, 0.68);
	border-radius: 6px;
	background: #171d10;
	color: #f4f7e8;
	font-weight: 800;
}

.status {
	min-width: 172px;
	color: #66d6ff;
	font-weight: 800;
	text-align: right;
}

.layout {
	display: grid;
	grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
	gap: 12px;
	width: min(100%, 1500px);
	margin: 0 auto;
	padding: 14px;
}

.panel {
	min-width: 0;
	padding: 12px;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: var(--panel);
	box-shadow: var(--shadow);
}

.sync-panel,
.import-panel,
.results-panel {
	grid-column: span 2;
}

.section-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 10px;
}

.actions {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 32px;
	border: 1px solid #6f614b;
	border-radius: 6px;
	background: #d8c49a;
	color: #201a12;
	padding: 0 12px;
	font-weight: 800;
	cursor: pointer;
}

.btn:hover {
	filter: brightness(0.98);
}

.btn.primary {
	border-color: #1f4e3e;
	background: var(--green);
	color: #fff;
}

.btn.ghost {
	background: var(--panel-soft);
}

.file-btn {
	display: inline-flex;
}

.file-input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.sync-note {
	color: var(--muted);
}

.sync-box {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 10px;
	padding: 10px;
	border: 1px dashed var(--line);
	border-radius: 6px;
	background: var(--panel-soft);
	overflow: auto;
}

code {
	font-family: Consolas, "Courier New", monospace;
	font-size: 12px;
}

textarea,
input,
select {
	border: 1px solid var(--line);
	border-radius: 5px;
	background: #fff;
	color: var(--text);
	font: inherit;
}

textarea {
	display: block;
	width: 100%;
	min-height: 118px;
	padding: 8px;
	resize: vertical;
	font-family: Consolas, "Courier New", monospace;
	font-size: 12px;
}

input,
select {
	width: 100%;
	min-height: 34px;
	padding: 5px 7px;
}

label {
	display: grid;
	gap: 4px;
	color: var(--muted);
	font-size: 12px;
	font-weight: 800;
}

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

.server-sync-row {
	display: grid;
	grid-template-columns: minmax(120px, 1fr) auto;
	gap: 6px;
}

.summary-row {
	display: flex;
	gap: 14px;
	margin-top: 6px;
	color: var(--muted);
	font-weight: 800;
}

.chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	min-height: 34px;
}

.chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: var(--panel-soft);
	padding: 6px 9px;
	color: var(--text);
	cursor: pointer;
	user-select: none;
}

.chip.is-active {
	border-color: rgba(47, 111, 88, 0.58);
	background: #eef8e6;
}

.chip-name {
	max-width: 180px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.chip-count {
	display: inline-flex;
	align-items: center;
	min-height: 20px;
	padding: 0 6px;
	border-radius: 999px;
	background: #e6ded2;
	color: var(--muted);
	font-size: 12px;
	font-weight: 800;
}

.chip.is-active .chip-count {
	background: var(--green);
	color: #fff;
}

.chip input {
	width: 14px;
	min-height: 14px;
	height: 14px;
	padding: 0;
}

.table-wrap {
	max-height: 520px;
	overflow: auto;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: #fff;
}

.table-wrap.compact {
	max-height: 300px;
}

.empty {
	padding: 14px;
}

table {
	width: 100%;
	min-width: 860px;
	border-collapse: collapse;
}

th,
td {
	border-bottom: 1px solid #e6ded2;
	padding: 7px 8px;
	text-align: left;
	vertical-align: middle;
	white-space: nowrap;
}

th {
	position: sticky;
	top: 0;
	z-index: 1;
	background: #ece4d7;
	color: #4b4237;
	font-size: 12px;
}

tbody tr:nth-child(even) {
	background: #fbf8f1;
}

tbody tr.is-late {
	background: #fff0ed;
}

.check-cell {
	width: 34px;
	text-align: center;
}

.check-cell input {
	width: 14px;
	height: 14px;
	min-height: 14px;
}

.muted {
	color: var(--muted);
}

.good {
	color: var(--green);
	font-weight: 800;
}

.warn {
	color: var(--amber);
	font-weight: 800;
}

.bad {
	color: var(--red);
	font-weight: 800;
}

.link {
	color: var(--blue);
	font-weight: 800;
}

.link:hover {
	text-decoration: underline;
}

.export-box {
	display: none;
	margin-top: 8px;
	min-height: 92px;
}

.export-box.visible {
	display: block;
}

@media (max-width: 1040px) {
	.topbar,
	.layout {
		grid-template-columns: 1fr;
	}

	.sync-panel,
	.import-panel,
	.results-panel {
		grid-column: auto;
	}

	.top-actions {
		flex-wrap: wrap;
	}

	.status {
		text-align: left;
	}
}

@media (max-width: 720px) {
	.topbar {
		padding: 14px 12px;
	}

	.layout {
		padding: 10px;
	}

	.section-head,
	.server-sync-row {
		align-items: stretch;
		grid-template-columns: 1fr;
	}

	.section-head {
		display: grid;
	}

	.fields-grid {
		grid-template-columns: 1fr;
	}

	.top-actions,
	.top-actions .btn,
	.language-select,
	.language-select select {
		width: 100%;
	}
}
