:root {
	--bg: #f5f7fb;
	--card: #ffffff;
	--text: #1f2937;
	--muted: #556070;
	--primary: #0b3d91;
	--primary-soft: #e8efff;
	--danger: #a0002b;
	--ok: #0f7a43;
	--border: #d9e0ec;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: "Segoe UI", "Noto Sans", sans-serif;
	color: var(--text);
	background: radial-gradient(circle at top right, #e8efff, var(--bg) 35%);
}

a {
	color: var(--primary);
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

.container {
	width: min(1050px, 92vw);
	margin: 0 auto;
}

.topbar {
	border-bottom: 1px solid var(--border);
	background: var(--card);
	position: sticky;
	top: 0;
	z-index: 20;
}

.topbar-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.8rem 0;
	gap: 0.8rem;
	flex-wrap: wrap;
}

.brand {
	margin: 0;
	font-size: 1.15rem;
}

.main-nav {
	display: flex;
	gap: 0.75rem;
	flex-wrap: wrap;
	align-items: center;
}

.link-button {
	border: 0;
	padding: 0;
	margin: 0;
	background: transparent;
	color: var(--primary);
	font: inherit;
	cursor: pointer;
}

.page {
	padding: 1rem 0 2rem;
}

.card {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 1rem;
	margin-bottom: 1rem;
}

.grid {
	display: grid;
	gap: 1rem;
}

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

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

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

.field {
	margin-bottom: 0.85rem;
}

label {
	display: block;
	margin-bottom: 0.35rem;
	font-size: 0.92rem;
	color: var(--muted);
}

input,
select {
	width: 100%;
	padding: 0.6rem 0.7rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: #fff;
	font: inherit;
}

.actions {
	display: flex;
	gap: 0.6rem;
	flex-wrap: wrap;
}

button,
input[type="submit"],
.button {
	border: 0;
	border-radius: 8px;
	background: var(--primary);
	color: #fff;
	padding: 0.6rem 0.85rem;
	cursor: pointer;
	font: inherit;
}

.button.secondary,
button.secondary {
	background: var(--primary-soft);
	color: var(--primary);
}

.button.danger,
button.danger {
	background: #fde9ef;
	color: var(--danger);
}

.icon-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.9rem;
	height: 1.9rem;
	padding: 0;
	border: 0;
	border-radius: 0.55rem;
	background: var(--primary-soft);
	color: var(--primary);
	text-decoration: none;
	cursor: pointer;
	line-height: 0;
}

.icon-button.danger {
	background: #fde9ef;
	color: var(--danger);
}

.icon-button svg,
.icon-button img {
	width: 0.85rem;
	height: 0.85rem;
	display: block;
}

.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;
}

.flash {
	border-radius: 8px;
	padding: 0.65rem 0.8rem;
	margin-top: 0;
}

.flash-notice {
	color: var(--ok);
	background: #e8f6ef;
}

.flash-alert {
	color: var(--danger);
	background: #ffe9ef;
}

.errors {
	border: 1px solid #f3c5d3;
	background: #fff4f8;
	color: var(--danger);
	border-radius: 8px;
	padding: 0.75rem;
	margin-bottom: 1rem;
}

table {
	width: 100%;
	border-collapse: collapse;
	background: #fff;
}

th,
td {
	border-bottom: 1px solid var(--border);
	text-align: left;
	padding: 0.6rem;
	font-size: 0.95rem;
}

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

.chart-wrap {
	min-height: 340px;
}

.stat {
	font-size: 1.25rem;
	font-weight: 600;
}

@media (min-width: 768px) {
	.grid-2 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.grid-3 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 1024px) {
	.grid-4 {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	table,
	thead,
	tbody,
	th,
	td,
	tr {
		display: block;
	}

	thead {
		display: none;
	}

	tr {
		border: 1px solid var(--border);
		border-radius: 10px;
		margin-bottom: 0.7rem;
		background: #fff;
		padding: 0.35rem;
	}

	td {
		border: 0;
		border-bottom: 1px dashed var(--border);
	}

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