@font-face {
	font-family: "Pop Happiness";
	src: url("fonts/FOT-PopHappinessStd-EB.otf") format("opentype");
	font-weight: 800;
	font-style: normal;
	font-display: swap;
}

:root {
	--bg: #f5f0eb;
	--bg-card: #ffffff;
	--text: #1a1a1a;
	--text-muted: #6b6b6b;
	--border: #1a1a1a;
	--accent: #339af0;
	--accent-hover: #1c7ed6;
	--danger: #ff6b6b;
	--danger-hover: #e03131;
	--sidebar-bg: #1a1a1a;
	--sidebar-text: #f5f0eb;
	--sidebar-hover: #333333;
	--shadow: #1a1a1a;
	--font-display: "Pop Happiness", "Lilita One", "DM Sans", sans-serif;
	--font-body: "DM Sans", system-ui, -apple-system, sans-serif;
}

body.dark {
	--bg: #1a1a1a;
	--bg-card: #2a2a2a;
	--text: #f5f0eb;
	--text-muted: #a0a0a0;
	--border: #f5f0eb;
	--sidebar-bg: #111111;
	--sidebar-text: #f5f0eb;
	--sidebar-hover: #333333;
	--shadow: #000000;
}

*,
*::before,
*::after {
	box-sizing: border-box;
	border-radius: 0;
}

body {
	margin: 0;
	min-height: 100vh;
	font-family: var(--font-body);
	font-size: 14px;
	background: var(--bg);
	color: var(--text);
	transition: background 0.2s, color 0.2s;
}

.layout {
	min-height: 100vh;
}

.sidebar {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	width: 220px;
	background: var(--sidebar-bg);
	color: var(--sidebar-text);
	border-right: 3px solid var(--border);
	display: flex;
	flex-direction: column;
}

.logo {
	height: 100px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-bottom: 3px solid #333333;
	font-family: var(--font-display);
	font-size: 54px;
	color: #ffd43b;
}

.nav {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 12px 0;
}

.nav-btn {
	width: 100%;
	background: transparent;
	color: var(--sidebar-text);
	border: none;
	border-left: 4px solid transparent;
	padding: 12px 20px;
	display: flex;
	align-items: center;
	gap: 12px;
	font-family: var(--font-body);
	font-size: 14px;
	font-weight: 600;
	text-align: left;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s;
}

.nav-btn:focus-visible {
	outline: 3px solid var(--accent);
	outline-offset: -3px;
}

.nav-btn.active {
	background: var(--sidebar-hover);
	border-left-color: #ffd43b;
	color: #ffd43b;
}

.sidebar-footer {
	margin-top: auto;
	padding: 16px;
	border-top: 3px solid #333333;
}

.main {
	margin-left: 220px;
	max-width: 960px;
	padding: 32px 40px;
}

.page-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 20px;
	margin-bottom: 24px;
}

.page-title {
	font-family: var(--font-display);
	font-size: 36px;
	margin: 0 0 8px;
}

.subtitle {
	font-size: 15px;
	margin: 0;
	color: var(--text-muted);
}

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

.panel {
	display: none;
}

.panel.active {
	display: block;
}

.card {
	background: var(--bg-card);
	border: 3px solid var(--border);
	padding: 24px;
	margin-bottom: 24px;
	box-shadow: 6px 6px 0 var(--shadow);
}

.card-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	margin-bottom: 16px;
}

.card-title {
	font-family: var(--font-display);
	font-size: 22px;
	margin: 0;
}

.card-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 16px;
	margin-bottom: 24px;
}

.stat-card {
	display: flex;
	align-items: center;
	gap: 16px;
}

.stat-value {
	font-family: var(--font-display);
	font-size: 26px;
}

.icon {
	width: 18px;
	height: 18px;
}

.icon-lg {
	width: 22px;
	height: 22px;
}

.icon-box {
	width: 48px;
	height: 48px;
	border: 3px solid var(--border);
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--accent);
}

.accent-yellow {
	background: #ffd43b;
}

.accent-blue {
	background: #339af0;
}

.control-grid {
	display: grid;
	gap: 16px;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	align-items: end;
}

.field {
	display: grid;
	gap: 8px;
}

label,
.label {
	font-size: 12px;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--text-muted);
}

select,
input[type="text"],
textarea {
	width: 100%;
	border: 3px solid var(--border);
	padding: 10px 14px;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-body);
	font-size: 14px;
}

textarea {
	padding: 12px;
}

select:focus-visible,
input[type="text"]:focus-visible,
textarea:focus-visible {
	outline: 3px solid var(--accent);
	outline-offset: -3px;
}

.checkbox-row {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 14px;
	font-weight: 600;
	grid-column: 1 / -1;
}

.checkbox {
	appearance: none;
	width: 20px;
	height: 20px;
	border: 3px solid var(--border);
	background: var(--bg);
	position: relative;
	cursor: pointer;
}

.checkbox:checked {
	background: var(--accent);
}

.checkbox:checked::after {
	content: "";
	position: absolute;
	left: 5px;
	top: 1px;
	width: 6px;
	height: 12px;
	border: 3px solid #ffffff;
	border-top: 0;
	border-left: 0;
	transform: rotate(45deg);
}

.checkbox:focus-visible {
	outline: 3px solid var(--accent);
	outline-offset: 2px;
}

.status-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	border: 3px solid var(--border);
	background: var(--bg);
}

.status {
	font-weight: 700;
	padding: 6px 12px;
	border: 3px solid var(--border);
	background: var(--bg-card);
}

.status[data-state="loading"] {
	background: #ffd43b;
	color: #1a1a1a;
}

.status[data-state="error"] {
	background: var(--danger);
	color: #1a1a1a;
}

.status[data-state="ok"] {
	background: var(--accent);
	color: #ffffff;
}

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

.note {
	font-size: 12px;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--text-muted);
}

.map {
	height: 360px;
	border: 3px solid var(--border);
	background: var(--bg);
}

.map-empty {
	margin-top: 12px;
	padding: 10px 14px;
	border: 3px solid var(--border);
	background: var(--bg);
	font-size: 13px;
}

.map-empty:empty {
	display: none;
}

pre {
	margin: 0;
	padding: 12px;
	border: 3px solid var(--border);
	background: var(--bg);
	font-family: var(--font-body);
	font-size: 13px;
	line-height: 1.5;
	white-space: pre-wrap;
	word-break: break-word;
}

.footer {
	text-align: center;
	font-size: 13px;
	color: var(--text-muted);
}

.btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	font-family: var(--font-body);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	border: 3px solid var(--border);
	background: var(--bg-card);
	color: var(--text);
	box-shadow: 4px 4px 0 var(--shadow);
	transition: transform 0.1s, box-shadow 0.1s;
}

.btn:active {
	transform: translate(2px, 2px);
	box-shadow: 2px 2px 0 var(--shadow);
}

.btn-primary {
	background: var(--accent);
	color: #ffffff;
}

.btn-outline {
	background: var(--bg-card);
	color: var(--text);
}

.btn-danger {
	background: var(--danger);
	color: #ffffff;
}

.btn-sm {
	padding: 6px 12px;
	font-size: 12px;
	box-shadow: 3px 3px 0 var(--shadow);
}

.toast-container {
	position: fixed;
	top: 20px;
	right: 20px;
	z-index: 9999;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.toast {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 18px;
	border: 3px solid var(--border);
	background: var(--bg-card);
	box-shadow: 4px 4px 0 var(--shadow);
	transform: translateX(40px);
	opacity: 0;
	animation: toast-in 0.25s ease forwards;
}

.toast-out {
	animation: toast-out 0.2s ease forwards;
}

@keyframes toast-in {
	to {
		transform: translateX(0);
		opacity: 1;
	}
}

@keyframes toast-out {
	to {
		transform: translateX(40px);
		opacity: 0;
	}
}

@media (max-width: 768px) {
	.sidebar {
		width: 60px;
	}

	.logo {
		font-size: 0;
		color: transparent;
	}

	.nav-btn {
		justify-content: center;
		padding: 12px;
	}

	.nav-btn span {
		display: none;
	}

	.main {
		margin-left: 60px;
		padding: 20px 16px;
	}

	.page-title {
		font-size: 26px;
	}

	.card-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.page-header {
		flex-direction: column;
		align-items: flex-start;
	}
}
