@font-face {
	font-family: "SN Pro";
	src: url("/fonts/SNPro-Regular.woff2") format("woff2");
	font-weight: 400;
	font-display: swap;
}
@font-face {
	font-family: "SN Pro";
	src: url("/fonts/SNPro-Medium.woff2") format("woff2");
	font-weight: 500;
	font-display: swap;
}
@font-face {
	font-family: "SN Pro";
	src: url("/fonts/SNPro-Semibold.woff2") format("woff2");
	font-weight: 600;
	font-display: swap;
}
@font-face {
	font-family: "SN Pro";
	src: url("/fonts/SNPro-Bold.woff2") format("woff2");
	font-weight: 700;
	font-display: swap;
}

:root {
	--bg: #0b0b0c;
	--surface: #141414;
	--surface-2: #1b1b1c;
	--surface-3: #232325;
	--line: rgba(250, 250, 250, 0.07);
	--line-strong: rgba(250, 250, 250, 0.12);
	--text: #fafafa;
	--text-2: rgba(250, 250, 250, 0.7);
	--text-3: rgba(250, 250, 250, 0.45);
	--red: #ff6b61;
	--amber: #f2b84b;
	--green: #4fd18b;
	--radius: 20px;
	--radius-sm: 12px;
	--ease: cubic-bezier(0.4, 0, 0.2, 1);
	--jiggle: cubic-bezier(0.55, -0.03, 0.15, 1.41);
	color-scheme: dark;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: "SN Pro", system-ui, sans-serif;
	font-size: 15px;
	line-height: 1.45;
	letter-spacing: -0.015em;
	-webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
	font: inherit;
	letter-spacing: inherit;
	color: inherit;
}

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

.icon {
	display: inline-block;
	width: 18px;
	height: 18px;
	flex: none;
	background: currentColor;
	-webkit-mask: var(--icon) center / contain no-repeat;
	mask: var(--icon) center / contain no-repeat;
}

/* Layout ---------------------------------------------------------------------------------------------------------- */

.shell {
	display: grid;
	grid-template-columns: 232px minmax(0, 1fr);
	min-height: 100vh;
}

.side {
	position: sticky;
	top: 0;
	height: 100vh;
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 20px 14px;
	border-right: 1px solid var(--line);
}

.brand {
	display: flex;
	align-items: baseline;
	gap: 8px;
	padding: 4px 10px 18px;
	font-weight: 700;
	font-size: 19px;
	letter-spacing: -0.03em;
}

.brand span {
	font-weight: 500;
	color: var(--text-3);
	font-size: 15px;
}

.project {
	margin: 0 0 14px;
	width: 100%;
}

.nav {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 9px 10px;
	border-radius: var(--radius-sm);
	color: var(--text-2);
	font-weight: 500;
	transition:
		background 0.15s var(--ease),
		color 0.15s var(--ease);
}

.nav:hover {
	background: var(--surface);
	color: var(--text);
}

.nav.active {
	background: var(--surface-2);
	color: var(--text);
}

.nav .count {
	margin-left: auto;
	font-size: 12px;
	font-weight: 600;
	padding: 1px 8px;
	border-radius: 999px;
	background: rgba(255, 107, 97, 0.14);
	color: var(--red);
}

.side .spacer {
	flex: 1;
}

button.nav {
	border: 0;
	background: none;
	width: 100%;
	cursor: pointer;
	text-align: left;
}

.side .who {
	padding: 10px;
	font-size: 13px;
	color: var(--text-3);
}

main {
	padding: 28px 32px 64px;
	max-width: 1240px;
	width: 100%;
}

.head {
	display: flex;
	align-items: flex-end;
	gap: 16px;
	flex-wrap: wrap;
	margin: 4px 0 22px;
}

.head h1 {
	margin: 0;
	font-size: 30px;
	font-weight: 700;
	letter-spacing: -0.035em;
	line-height: 1.1;
}

.head .sub {
	color: var(--text-3);
	font-size: 14px;
	margin-top: 4px;
}

.head .actions {
	margin-left: auto;
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.back {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--text-3);
	font-size: 14px;
	margin-bottom: 10px;
}

.back:hover {
	color: var(--text);
}

.grid {
	display: grid;
	gap: 14px;
}

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

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

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

.span-2 {
	grid-column: span 2;
}

/* Cards ----------------------------------------------------------------------------------------------------------- */

.card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 20px;
	min-width: 0;
}

.card h2 {
	margin: 0 0 14px;
	font-size: 15px;
	font-weight: 600;
	display: flex;
	align-items: center;
	gap: 8px;
}

.card h2 .hint {
	margin-left: auto;
	font-weight: 500;
	color: var(--text-3);
	font-size: 13px;
}

.stat {
	position: relative;
	overflow: hidden;
}

.stat .label {
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--text-2);
	font-weight: 500;
	font-size: 14px;
}

.stat .value {
	margin-top: 14px;
	font-size: 40px;
	font-weight: 700;
	letter-spacing: -0.045em;
	line-height: 1;
}

.stat .value small {
	font-size: 15px;
	font-weight: 500;
	letter-spacing: -0.015em;
	color: var(--text-3);
	margin-left: 6px;
}

.stat.bad .value {
	color: var(--red);
}

/* Faint Papicons pattern on the stat cards. */
.stat::after {
	content: "";
	position: absolute;
	right: -18px;
	bottom: -22px;
	width: 110px;
	height: 110px;
	background: var(--text);
	opacity: 0.035;
	-webkit-mask: var(--icon) center / contain no-repeat;
	mask: var(--icon) center / contain no-repeat;
	pointer-events: none;
}

/* Charts (one thick line, no grid, a glowing end dot) ---------------------------------------------------------------- */

.chart {
	position: relative;
}

.chart .top {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-bottom: 14px;
}

.chart .big {
	font-size: 34px;
	font-weight: 700;
	letter-spacing: -0.045em;
	line-height: 1;
}

.chart .den {
	color: var(--text-3);
	font-weight: 500;
}

.chart .title {
	margin-left: auto;
	color: var(--text-2);
	font-weight: 500;
	font-size: 14px;
}

.chart .plot {
	position: relative;
	height: var(--h, 120px);
}

.chart svg {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
}

.chart path {
	fill: none;
	stroke: var(--stroke, var(--text));
	stroke-width: 3;
	stroke-linecap: round;
	stroke-linejoin: round;
	vector-effect: non-scaling-stroke;
}

.chart .dot {
	position: absolute;
	width: 10px;
	height: 10px;
	margin: -5px 0 0 -5px;
	border-radius: 50%;
	background: var(--stroke, var(--text));
	box-shadow:
		0 0 0 4px rgba(250, 250, 250, 0.08),
		0 0 18px 4px var(--glow, rgba(250, 250, 250, 0.45));
}

.chart .axis {
	display: flex;
	justify-content: space-between;
	margin-top: 10px;
	color: var(--text-3);
	font-size: 12px;
}

.card.fill {
	display: flex;
	flex-direction: column;
}

.card.fill .chart {
	flex: 1;
	display: flex;
	flex-direction: column;
}

.card.fill .plot {
	flex: 1;
	min-height: var(--h, 120px);
}

.chart .empty {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	color: var(--text-3);
	font-size: 14px;
}

.chart.red {
	--stroke: var(--red);
	--glow: rgba(255, 107, 97, 0.5);
}

/* Lists and tables ------------------------------------------------------------------------------------------------ */

.rows {
	display: flex;
	flex-direction: column;
}

.row {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 11px 4px;
	border-top: 1px solid var(--line);
	min-width: 0;
}

.row:first-child {
	border-top: 0;
}

a.row {
	border-radius: 10px;
	padding-left: 10px;
	padding-right: 10px;
	margin: 0 -6px;
	transition: background 0.15s var(--ease);
}

a.row:hover {
	background: var(--surface-2);
}

.row .main {
	flex: 1;
	min-width: 0;
}

.row .title {
	font-weight: 500;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.row .meta {
	color: var(--text-3);
	font-size: 13px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.row .num {
	text-align: right;
	font-variant-numeric: tabular-nums;
	color: var(--text-2);
	font-size: 14px;
	white-space: nowrap;
}

.row .num b {
	color: var(--text);
	font-weight: 600;
}

.empty-note {
	color: var(--text-3);
	font-size: 14px;
	padding: 8px 0;
}

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

th {
	text-align: left;
	font-weight: 500;
	color: var(--text-3);
	font-size: 13px;
	padding: 0 10px 10px;
}

td {
	padding: 10px;
	border-top: 1px solid var(--line);
	vertical-align: top;
	color: var(--text-2);
}

td.strong {
	color: var(--text);
	font-weight: 500;
}

td.wrap {
	word-break: break-word;
}

.table-scroll {
	overflow-x: auto;
	margin: 0 -10px;
}

/* Badges, buttons, inputs ----------------------------------------------------------------------------------------- */

.badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 2px 9px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	background: var(--surface-3);
	color: var(--text-2);
	white-space: nowrap;
}

.badge.red {
	background: rgba(255, 107, 97, 0.14);
	color: var(--red);
}

.badge.amber {
	background: rgba(242, 184, 75, 0.14);
	color: var(--amber);
}

.badge.green {
	background: rgba(79, 209, 139, 0.13);
	color: var(--green);
}

.live-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--green);
	box-shadow: 0 0 10px 2px rgba(79, 209, 139, 0.5);
	flex: none;
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 38px;
	padding: 0 16px;
	border-radius: 999px;
	border: 1px solid var(--line-strong);
	background: var(--surface-2);
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	white-space: nowrap;
	transition:
		background 0.15s var(--ease),
		transform 0.2s var(--jiggle);
}

.btn:hover {
	background: var(--surface-3);
}

.btn:active {
	transform: scale(0.97);
}

.btn.primary {
	background: var(--text);
	color: #0b0b0c;
	border-color: transparent;
}

.btn.primary:hover {
	background: #e6e6e6;
}

.btn.danger {
	color: var(--red);
}

.btn.small {
	height: 30px;
	padding: 0 12px;
	font-size: 13px;
}

.btn:disabled {
	opacity: 0.45;
	cursor: default;
}

.input,
select.input,
textarea.input {
	height: 40px;
	padding: 0 14px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--line-strong);
	background: var(--bg);
	outline: none;
	min-width: 0;
	transition: border-color 0.15s var(--ease);
}

textarea.input {
	height: auto;
	min-height: 84px;
	padding: 10px 14px;
	resize: vertical;
}

.input:focus {
	border-color: rgba(250, 250, 250, 0.35);
}

.input::placeholder {
	color: var(--text-3);
}

.field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-size: 13px;
	color: var(--text-2);
	font-weight: 500;
	min-width: 0;
}

.form {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	align-items: flex-end;
}

.form > .grow {
	flex: 1;
	min-width: 180px;
}

.field .input {
	width: 100%;
}

.tabs {
	display: inline-flex;
	gap: 4px;
	padding: 4px;
	border-radius: 999px;
	background: var(--surface);
	border: 1px solid var(--line);
	margin-bottom: 16px;
}

.tab {
	padding: 6px 14px;
	border-radius: 999px;
	color: var(--text-2);
	font-weight: 500;
	font-size: 14px;
}

.tab.active {
	background: var(--surface-3);
	color: var(--text);
}

.tab .n {
	color: var(--text-3);
	margin-left: 4px;
}

pre.code {
	margin: 0;
	padding: 14px 16px;
	border-radius: var(--radius-sm);
	background: var(--bg);
	border: 1px solid var(--line);
	font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
	font-size: 12.5px;
	line-height: 1.55;
	color: var(--text-2);
	white-space: pre-wrap;
	word-break: break-word;
	letter-spacing: 0;
}

.notice {
	padding: 12px 14px;
	border-radius: var(--radius-sm);
	background: var(--surface-2);
	color: var(--text-2);
	font-size: 14px;
}

.notice.red {
	background: rgba(255, 107, 97, 0.1);
	color: var(--red);
}

.notice.green {
	background: rgba(79, 209, 139, 0.1);
	color: var(--green);
}

.toast {
	position: fixed;
	left: 50%;
	bottom: 28px;
	transform: translateX(-50%) translateY(20px);
	opacity: 0;
	padding: 12px 18px;
	border-radius: 999px;
	background: var(--text);
	color: #0b0b0c;
	font-weight: 600;
	font-size: 14px;
	transition:
		opacity 0.2s var(--ease),
		transform 0.35s var(--jiggle);
	pointer-events: none;
	z-index: 10;
	max-width: calc(100vw - 32px);
}

.toast.show {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

.toast.bad {
	background: var(--red);
}

.status {
	font-weight: 600;
	font-size: 13px;
}

.status.done {
	color: var(--green);
}

.status.failed,
.status.expired {
	color: var(--red);
}

.status.pending,
.status.claimed {
	color: var(--amber);
}

.crumbs {
	display: flex;
	flex-direction: column;
	gap: 2px;
	font-size: 13px;
}

.crumbs div {
	display: flex;
	gap: 12px;
	padding: 6px 0;
	border-top: 1px solid var(--line);
	color: var(--text-2);
}

.crumbs h2 {
	margin: 18px 0 6px;
}

.crumbs time {
	color: var(--text-3);
	flex: none;
	width: 92px;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.kv {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: 8px 18px;
	font-size: 14px;
}

.kv dt {
	color: var(--text-3);
}

.kv dd {
	margin: 0;
	color: var(--text);
	word-break: break-word;
}

/* Sign-in --------------------------------------------------------------------------------------------------------- */

.login {
	min-height: 100vh;
	display: grid;
	place-items: center;
	padding: 24px 16px;
}

.login .card {
	width: 100%;
	max-width: 380px;
	padding: 28px;
	position: relative;
	overflow: hidden;
}

.login h1 {
	margin: 0 0 4px;
	font-size: 26px;
	letter-spacing: -0.035em;
}

.login p {
	margin: 0 0 22px;
	color: var(--text-3);
	font-size: 14px;
}

.login form {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.login .btn {
	margin-top: 6px;
	height: 42px;
}

/* Small screens --------------------------------------------------------------------------------------------------- */

@media (max-width: 1100px) {
	.cols-4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
	.cols-3 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 820px) {
	.shell {
		grid-template-columns: minmax(0, 1fr);
	}
	.side {
		position: sticky;
		z-index: 5;
		height: auto;
		flex-direction: row;
		align-items: center;
		overflow-x: auto;
		padding: 10px 16px;
		border-right: 0;
		border-bottom: 1px solid var(--line);
		background: rgba(11, 11, 12, 0.92);
		backdrop-filter: blur(12px);
	}
	.brand {
		padding: 0 8px 0 0;
	}
	.brand span,
	.side .spacer,
	.side .who {
		display: none;
	}
	.project {
		flex: none;
		margin: 0;
		width: 150px;
	}
	.nav {
		flex: none;
		padding: 8px 10px;
	}
	.nav .label {
		display: none;
	}
	main {
		padding: 20px 16px 48px;
	}
	.cols-2,
	.cols-3 {
		grid-template-columns: minmax(0, 1fr);
	}
	.span-2 {
		grid-column: auto;
	}
	.head h1 {
		font-size: 26px;
	}
}

@media (max-width: 480px) {
	.stat {
		padding: 16px;
	}
	.stat .value {
		font-size: 30px;
		margin-top: 10px;
	}
	.stat .label {
		font-size: 13px;
	}
	.chart .big {
		font-size: 28px;
	}
}
