/* ── reset ──────────────────────────────────────────────────────────────── */

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

/* ── tokens ─────────────────────────────────────────────────────────────── */

:root {
	--bg: #f7f6f3;
	--surface: #fffefb;
	--ink: #1b1d1f;
	--muted: #6b6f76;
	--border: #d9d7d0;
	--accent: #0a6b3d;
	--danger: #b3261e;
	--blue: #095697;
	--amber: #9a6700;
	--radius: 2px;
}

/* ── fonts ──────────────────────────────────────────────────────────────── */

@font-face {
	font-family: "Ubuntu Mono";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("/assets/fonts/ubuntumono-regular.woff2") format("woff2");
}

@font-face {
	font-family: "Ubuntu Mono";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("/assets/fonts/ubuntumono-bold.woff2") format("woff2");
}

/* ── base ───────────────────────────────────────────────────────────────── */

html {
	-webkit-text-size-adjust: 100%;
}

body {
	background: var(--bg);
	color: var(--ink);
	font-family: "Ubuntu Mono", ui-monospace, "Cascadia Mono", Menlo,
	    Consolas, monospace;
	font-size: 14px;
	line-height: 1.65;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	-webkit-font-smoothing: antialiased;
}

a {
	color: var(--blue);
	text-decoration: underline;
	text-underline-offset: 2px;
}

a:hover {
	color: var(--ink);
}

.wrap {
	width: 100%;
	max-width: 1000px;
	margin: 0 auto;
	padding: 0 1rem;
}

main.wrap {
	flex: 1;
	padding-top: 2rem;
	padding-bottom: 3rem;
}

::selection {
	background: var(--ink);
	color: var(--bg);
}

/* ── header / nav ───────────────────────────────────────────────────────── */

.site-head {
	border-bottom: 1px solid var(--border);
	background: var(--surface);
}

.head-in {
	display: flex;
	align-items: center;
	gap: 1rem;
	min-height: 56px;
	flex-wrap: wrap;
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	color: var(--ink);
	text-decoration: none;
	font-weight: 700;
	font-size: 15px;
	letter-spacing: 0.04em;
}

.brand svg {
	width: 18px;
	height: 18px;
	color: var(--accent);
}

.head-nav {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.head-user {
	color: var(--muted);
	font-size: 13px;
}

/* ── footer ─────────────────────────────────────────────────────────────── */

.site-foot {
	border-top: 1px solid var(--border);
	padding: 0.75rem 0;
}

.foot-in {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 1rem;
	color: var(--muted);
	font-size: 12px;
}

.foot-brand {
	justify-self: start;
}

.foot-center {
	justify-self: center;
}

.foot-version {
	justify-self: end;
}

/* ── typography ─────────────────────────────────────────────────────────── */

h1 {
	font-size: 22px;
	font-weight: 700;
	letter-spacing: -0.01em;
	margin: 0.1rem 0 0.25rem;
}

.page-sub {
	color: var(--muted);
	font-size: 12px;
	margin-bottom: 1.5rem;
}

.page-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	margin-bottom: 1.5rem;
}

.page-head > div {
	min-width: 0;
	max-width: 100%;
}

h2 {
	font-size: 14px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	margin: 2rem 0 0.75rem;
}

.mono-note {
	color: var(--muted);
	font-size: 12px;
}

/* ── banners / states ───────────────────────────────────────────────────── */

.banner {
	border: 1px solid var(--border);
	background: var(--surface);
	border-radius: var(--radius);
	padding: 0.7rem 1rem;
	margin-bottom: 1.25rem;
}

.banner-head {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex-wrap: wrap;
}

/* active messages live inside the banner card */
.banner-msg {
	margin-top: 0.7rem;
	padding-top: 0.7rem;
	border-top: 1px solid rgba(27, 29, 31, 0.12);
}

.banner-msg .msg-body {
	margin-top: 0.35rem;
}

.banner-text {
	font-weight: 700;
	font-size: 15px;
}

.banner-note {
	margin-left: auto;
}

.banner-ok, .banner-up {
	border-color: #bdd9c8;
	background: #eef6f0;
}

.banner-ok .banner-text, .banner-up .banner-text {
	color: #0a5c35;
}

.banner-down {
	border-color: #eccfca;
	background: #fbeeec;
}

.banner-down .banner-text {
	color: #a01f18;
}

.banner-warn {
	border-color: #eadcb2;
	background: #faf4e4;
}

.banner-warn .banner-text {
	color: #7a5200;
}

.banner-maint {
	border-color: #c9dcec;
	background: #eef4fa;
}

.banner-maint .banner-text {
	color: #0a4f8a;
}

.banner-unknown {
	border-color: var(--border);
}

/* up/down/no-data as tinted chips, same shape as the badges */
.state {
	display: inline-block;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	line-height: 1.5;
	border-radius: var(--radius);
	padding: 0.05rem 0.55rem;
	white-space: nowrap;
}

.state-up {
	color: #0a5c35;
	background: #dcefe4;
}

.state-down {
	color: #a01f18;
	background: #f6dcd8;
}

.state-unknown {
	color: #5b6066;
	background: #e9ebee;
}

/* ── uptime bars ────────────────────────────────────────────────────────── */

.bar {
	min-width: 0;
}

.bar-cells {
	display: flex;
	gap: 1px;
	align-items: stretch;
	width: 100%;
}

.bar-cells.bar-dense {
	gap: 0;
}

.cell {
	display: block;
	flex: 1 1 0;
	min-width: 0;
	height: 14px;
	border-radius: 1px;
	background: #e4e2dc;
}

.cell-ok {
	background: var(--accent);
}

.cell-bad {
	background: var(--danger);
}

.cell-mix {
	background: var(--amber);
}

.cell-none {
	background: #e4e2dc;
}

/* ── overall + group meters ─────────────────────────────────────────────── */

/* the checks section: one row per meter (overall + groups); every bar is
 * the same 180x14 strip.  the range switch lives in the overall row, next
 * to its label */
.overall-head {
	margin-top: 0;
}

/* keep the switch beside the label and push the meter to the right edge */
.overall-head .range-links {
	margin-right: auto;
}

.overall-head + .group-head {
	margin-top: 1.1rem;
}

/* stays available for page-level controls (refresh, back) */
.page-controls {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex-wrap: wrap;
}

.group-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin: 2rem 0 0.75rem;
}

.group-head h2 {
	margin: 0;
}

.group-meter {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex-shrink: 0;
	/* keep the meters above the same gutter the table cells use, so
	 * every bar lines up in one column with the row bars */
	margin-right: 0.75rem;
}

.group-meter .bar {
	width: 180px;
}

.range-links {
	display: flex;
	gap: 0.5rem;
	font-size: 12px;
}

.range-link {
	color: var(--blue);
	text-decoration: none;
	font-weight: 700;
}

.range-link:hover {
	color: var(--ink);
	text-decoration: underline;
}

.range-on {
	color: var(--ink);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ── pager (paged lists) ────────────────────────────────────────────────── */

.pager {
	display: flex;
	gap: 0.5rem;
	align-items: baseline;
	font-size: 12px;
	margin-bottom: 1rem;
}

.pager-link {
	color: var(--blue);
	text-decoration: none;
	font-weight: 700;
}

.pager-link:hover {
	color: var(--ink);
	text-decoration: underline;
}

.pager-off {
	color: var(--muted);
	opacity: 0.45;
	font-weight: 700;
}

/* ── messages ───────────────────────────────────────────────────────────── */

.msg {
	border: 1px solid var(--border);
	background: var(--surface);
	border-radius: var(--radius);
	padding: 0.6rem 0.9rem;
	font-size: 13px;
	margin-bottom: 1.25rem;
}

.msg-error {
	border-color: #eccfca;
	background: #fbeeec;
	color: var(--danger);
}

.msg-sev-info {
	border-color: #c9dcec;
	background: #eef4fa;
}

.msg-sev-maintenance {
	border-color: #c9dcec;
	background: #eef4fa;
}

.msg-sev-degraded {
	border-color: #eadcb2;
	background: #faf4e4;
}

.msg-sev-outage {
	border-color: #eccfca;
	background: #fbeeec;
}

.msg-resolved {
	opacity: 0.65;
}

.msg-head {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	flex-wrap: wrap;
}

.msg-title {
	font-size: 14px;
}

.msg-when {
	margin-left: auto;
}

.msg-actions {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
}

.msg-body {
	margin-top: 0.4rem;
}

.msg-body p {
	margin: 0.35rem 0;
}

/* ── buttons ────────────────────────────────────────────────────────────── */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	font-family: inherit;
	font-size: 13px;
	line-height: 1;
	padding: 0.45rem 0.9rem;
	border: 1px solid var(--ink);
	background: var(--ink);
	color: var(--bg);
	cursor: pointer;
	text-decoration: none;
	border-radius: var(--radius);
}

.btn:hover {
	background: var(--ink);
	color: var(--bg);
	opacity: 0.85;
	text-decoration: none;
}

.btn-ghost {
	background: transparent;
	color: var(--ink);
	border-color: var(--border);
}

.btn-ghost:hover {
	background: var(--surface);
	border-color: var(--ink);
	color: var(--ink);
	opacity: 1;
}

.btn-danger {
	background: transparent;
	color: var(--danger);
	border-color: var(--danger);
}

.btn-danger:hover {
	background: var(--danger);
	color: #fff;
	opacity: 1;
}

.btn-sm {
	padding: 0.2rem 0.5rem;
	font-size: 12px;
}

.btn-block {
	width: 100%;
}

/* ── forms ──────────────────────────────────────────────────────────────── */

label {
	display: block;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--muted);
	margin-bottom: 0.35rem;
}

input[type="text"], input[type="password"], input[type="search"],
select, textarea {
	font-family: inherit;
	font-size: 14px;
	color: var(--ink);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 0.45rem 0.6rem;
	max-width: 100%;
}

textarea {
	width: 100%;
	resize: vertical;
	line-height: 1.5;
}

input:focus, select:focus, textarea:focus {
	outline: 2px solid var(--accent);
	outline-offset: -1px;
	border-color: var(--accent);
}

.field {
	margin-bottom: 1.25rem;
}

.field input, .field select {
	width: 100%;
}

.msg-form {
	max-width: 640px;
}

.form-actions {
	display: flex;
	gap: 0.5rem;
	align-items: center;
}

.inline-form {
	display: inline;
}

/* ── tables ─────────────────────────────────────────────────────────────── */

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

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

.tbl th {
	text-align: left;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--muted);
	padding: 0.55rem 0.75rem;
	border-bottom: 1px solid var(--border);
	white-space: nowrap;
}

.tbl td {
	padding: 0.6rem 0.75rem;
	border-bottom: 1px solid var(--border);
	font-size: 13px;
	vertical-align: middle;
}

.tbl tbody tr:last-child td {
	border-bottom: none;
}

.tbl tbody tr:hover {
	background: #f2f1ec;
}

.tbl .num {
	text-align: right;
	white-space: nowrap;
}

.tbl-empty {
	padding: 2.5rem 1rem;
	text-align: center;
	color: var(--muted);
}

/* check overview: fixed columns keep the rows aligned across groups */
.tbl-checks {
	table-layout: fixed;
}

.tbl-checks .bar-col {
	width: calc(180px + 1.5rem);
}

/* row bars match the group meters: 180px, same gutter as the other cells */
.tbl-checks td.bar .bar-cells {
	width: 180px;
	margin-left: auto;
}

.tbl-checks th:nth-child(3),
.tbl-checks td:nth-child(3) {
	width: 5.5rem;
}

.tbl-checks th:nth-child(4),
.tbl-checks td:nth-child(4),
.tbl-checks th:nth-child(5),
.tbl-checks td:nth-child(5),
.tbl-checks th:nth-child(6),
.tbl-checks td:nth-child(6) {
	width: 4.5rem;
}

/* ── badges ─────────────────────────────────────────────────────────────── */

.badge {
	display: inline-block;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	line-height: 1.5;
	border-radius: var(--radius);
	padding: 0.05rem 0.55rem;
	white-space: nowrap;
}

.badge-info {
	color: #0a4f8a;
	background: #d9e7f2;
}

.badge-maintenance {
	color: #0a4f8a;
	background: #d9e7f2;
}

.badge-degraded {
	color: #7a5200;
	background: #f3e6c8;
}

.badge-outage {
	color: #a01f18;
	background: #f6dcd8;
}

.badge-default {
	color: #5b6066;
	background: #e9ebee;
}

/* ── details ────────────────────────────────────────────────────────────── */

details {
	border: 1px solid var(--border);
	background: var(--surface);
	border-radius: var(--radius);
	margin-top: 0.75rem;
	margin-bottom: 1.25rem;
}

details summary {
	cursor: pointer;
	padding: 0.6rem 0.9rem;
	font-size: 13px;
	color: var(--muted);
	list-style: none;
}

details summary::before {
	content: "> ";
	color: var(--accent);
}

details[open] summary {
	border-bottom: 1px solid var(--border);
}

details .msg {
	border: none;
	border-radius: 0;
	margin-bottom: 0;
	background: transparent;
}

details .msg + .msg {
	border-top: 1px solid var(--border);
}

/* ── login ──────────────────────────────────────────────────────────────── */

.login-main {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2rem 1rem;
}

.login-card {
	width: 100%;
	max-width: 360px;
	background: var(--surface);
	border: 1px solid var(--ink);
	border-radius: var(--radius);
	padding: 2rem 2rem 1.5rem;
}

.login-logo {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	justify-content: center;
	font-weight: 700;
	font-size: 17px;
	margin-bottom: 0.25rem;
}

.login-logo svg {
	width: 22px;
	height: 22px;
	color: var(--accent);
}

.login-sub {
	text-align: center;
	color: var(--muted);
	font-size: 12px;
	margin-bottom: 1.75rem;
}

.login-version {
	text-align: center;
	color: var(--muted);
	font-size: 11px;
	margin-top: 1.25rem;
}

/* ── responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 720px) {
	.page-head {
		flex-direction: column;
		align-items: stretch;
	}

	/* tables collapse into stacked cards */
	.tbl thead {
		display: none;
	}

	.tbl, .tbl tbody, .tbl tr, .tbl td {
		display: block;
		width: 100%;
	}

	.tbl tr {
		border-bottom: 1px solid var(--border);
		padding: 0.5rem 0;
	}

	.tbl td {
		border: none;
		padding: 0.25rem 0.75rem;
	}

	.tbl td::before {
		content: attr(data-label);
		display: inline-block;
		width: 8.5em;
		font-size: 10px;
		text-transform: uppercase;
		letter-spacing: 0.1em;
		color: var(--muted);
	}

	.tbl td.num {
		text-align: left;
	}

	.group-head {
		flex-wrap: wrap;
	}

	.group-meter .bar {
		width: 110px;
	}

	.tbl-checks td.bar .bar-cells {
		width: 110px;
	}
}
