:root {
	--brand: #303952;
	--brand-dark: #2b334a;
	--bg: #eceff4;
	--bg-panel: #ffffff;
	--bg-panel-alt: #f4f6f9;
	--bg-row-hover: #e7ecf3;
	--border: #d2d9e3;
	--text: #1d2330;
	--text-muted: #5e6a7a;
	--status-red: #c92a2a;
	--status-orange: #e8590c;
	--status-green: #2b8a3e;
	--status-grey: #7c8694;
	--warning: #d9820a;
	--radius: 10px;
	--toolbar-height: 60px;
	color-scheme: light;
}

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

html,
body {
	height: 100%;
	margin: 0;
}

body {
	background: var(--bg);
	color: var(--text);
	font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.45;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

body.scrollable {
	overflow: auto;
}

/* ---------- Toolbar ---------- */

.toolbar {
	height: var(--toolbar-height);
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 20px;
	padding: 0 20px;
	background: var(--bg-panel);
	border-bottom: 3px solid var(--brand);
}

.toolbar__brand {
	font-size: 20px;
	font-weight: 700;
	letter-spacing: 0.02em;
	white-space: nowrap;
}

.toolbar__brand span {
	color: var(--brand);
}

.toolbar__spacer {
	flex: 1 1 auto;
}

.toolbar__meta {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	font-size: 13px;
	color: var(--text-muted);
	line-height: 1.2;
}

.toolbar__clock {
	font-size: 19px;
	font-weight: 600;
	color: var(--text);
	font-variant-numeric: tabular-nums;
}

.toolbar__brand img {
  display: block;
  height: 60px;
  width: auto;
}

/* ---------- Controls ---------- */

button,
select,
input,
textarea {
	font: inherit;
	color: var(--text);
	background: var(--bg-panel-alt);
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 7px 10px;
}

button {
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

button:hover:not(:disabled) {
	background: var(--bg-row-hover);
}

button:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

button.primary {
	background: var(--brand);
	border-color: var(--brand);
	color: #fff;
	font-weight: 600;
}

button.primary:hover:not(:disabled) {
	background: var(--brand-dark);
	border-color: var(--brand-dark);
}

button.danger {
	border-color: var(--status-red);
	color: var(--status-red);
}

button.icon {
	padding: 4px 8px;
	line-height: 1;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
	outline: 2px solid var(--brand);
	outline-offset: 1px;
}

label {
	display: block;
	font-size: 13px;
	color: var(--text-muted);
	margin-bottom: 4px;
}

/* ---------- Dashboard ---------- */

.board {
	flex: 1 1 auto;
	display: flex;
	gap: 14px;
	padding: 14px;
	min-height: 0;
}

.board.vertical {
	flex-direction: row;
}

.board.horizontal {
	flex-direction: column;
}

.panel {
	flex: 1 1 0;
	min-width: 0;
	min-height: 0;
	display: flex;
	flex-direction: column;
	background: var(--bg-panel);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
}

.panel[hidden] {
	display: none;
}

.panel__head {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 14px;
	background: var(--bg-panel-alt);
	border-bottom: 1px solid var(--border);
}

.panel__title {
	font-size: 16px;
	font-weight: 600;
}

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

.panel__body {
	flex: 1 1 auto;
	overflow: auto;
	min-height: 0;
}

.panel__foot {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 6px 14px;
	border-top: 1px solid var(--border);
	font-size: 13px;
	color: var(--text-muted);
}

/* ---------- Tables ---------- */

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

thead th {
	position: sticky;
	top: 0;
	z-index: 1;
	background: var(--bg-panel-alt);
	text-align: left;
	font-weight: 600;
	padding: 9px 12px;
	border-bottom: 1px solid var(--border);
	white-space: nowrap;
	cursor: pointer;
	user-select: none;
}

thead th[data-sort="asc"]::after {
	content: " \25B2";
	color: var(--brand);
}

thead th[data-sort="desc"]::after {
	content: " \25BC";
	color: var(--brand);
}

tbody td {
	padding: 7px 12px;
	border-bottom: 1px solid var(--border);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 320px;
}

tbody tr:hover {
	background: var(--bg-row-hover);
}

tbody tr.warn td:first-child {
	box-shadow: inset 3px 0 0 var(--warning);
}

.status-dot {
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	vertical-align: -1px;
}

.status-dot.red {
	background: var(--status-red);
}

.status-dot.orange {
	background: var(--status-orange);
}

.status-dot.green {
	background: var(--status-green);
}

.status-dot.grey {
	background: var(--status-grey);
}

.warn-icon {
	color: var(--warning);
	font-weight: 700;
}

.empty {
	padding: 26px;
	text-align: center;
	color: var(--text-muted);
}

/* ---------- Banner ---------- */

.banner {
	flex: 0 0 auto;
	padding: 9px 20px;
	font-size: 14px;
	background: #fdeceb;
	border-bottom: 1px solid var(--status-red);
	color: #8f2020;
}

.banner[hidden] {
	display: none;
}

/* ---------- Login ---------- */

.login-wrap {
	flex: 1 1 auto;
	display: grid;
	place-items: center;
	padding: 20px;
}

.card {
	background: var(--bg-panel);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 26px;
}

.login-card {
	width: min(380px, 100%);
}

.login-card h1 {
	margin: 0 0 4px;
	font-size: 22px;
}

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

.field {
	margin-bottom: 16px;
}

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

.error-text {
	color: var(--status-red);
	font-size: 14px;
	min-height: 20px;
	margin-top: 10px;
}

/* ---------- Admin ---------- */

.admin-main {
	flex: 1 1 auto;
	overflow: auto;
	padding: 18px 22px 60px;
}

.tabs {
	display: flex;
	gap: 4px;
	border-bottom: 1px solid var(--border);
	margin-bottom: 22px;
}

.tab {
	background: none;
	border: none;
	border-bottom: 3px solid transparent;
	border-radius: 0;
	padding: 10px 16px;
	color: var(--text-muted);
}

.tab[aria-selected="true"] {
	color: var(--text);
	border-bottom-color: var(--brand);
	font-weight: 600;
}

.tabpanel[hidden] {
	display: none;
}

.grid {
	display: grid;
	gap: 16px;
	grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.row {
	display: flex;
	gap: 10px;
	align-items: center;
	flex-wrap: wrap;
}

.section {
	margin-bottom: 26px;
}

.section h2 {
	font-size: 17px;
	margin: 0 0 12px;
	padding-bottom: 6px;
	border-bottom: 1px solid var(--border);
}

.checklist {
	max-height: 260px;
	overflow: auto;
	border: 1px solid var(--border);
	border-radius: 6px;
	padding: 10px;
	background: var(--bg-panel-alt);
}

.checklist label {
	display: flex;
	align-items: center;
	gap: 8px;
	color: var(--text);
	margin: 0 0 6px;
	cursor: pointer;
	font-size: 14px;
}

.filter-row {
	display: grid;
	grid-template-columns: 90px 1fr 150px 1fr auto;
	gap: 8px;
	align-items: center;
	margin-bottom: 8px;
}

.toast {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 50;
	padding: 12px 18px;
	border-radius: var(--radius);
	background: var(--bg-panel);
	border: 1px solid var(--border);
	box-shadow: 0 8px 24px rgba(29, 35, 48, 0.18);
	max-width: 420px;
}

.toast.ok {
	border-color: var(--status-green);
}

.toast.err {
	border-color: var(--status-red);
}

.toast[hidden] {
	display: none;
}

.token-box {
	font-family: ui-monospace, Consolas, monospace;
	font-size: 13px;
	word-break: break-all;
	background: var(--bg);
	border: 1px dashed var(--brand);
	border-radius: 6px;
	padding: 10px;
	margin-top: 8px;
}

@media (max-width: 900px) {
	.board.vertical {
		flex-direction: column;
	}

	.filter-row {
		grid-template-columns: 1fr;
	}
}
