:root {
	--bg: #f5f6f7;
	--panel: #ffffff;
	--text: #202833;
	--muted: #697586;
	--line: #d8dee6;
	--line-strong: #bcc7d3;
	--primary: #2563eb;
	--primary-dark: #1d4ed8;
	--success: #0f8f6f;
	--success-dark: #08745a;
	--danger: #c2412d;
	--danger-dark: #9f3323;
	--warning: #b7791f;
	--shadow: 0 12px 30px rgba(32, 40, 51, 0.08);
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
	font-size: 15px;
	letter-spacing: 0;
}

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

.topbar {
	position: sticky;
	top: 0;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 18px 28px;
	background: rgba(255, 255, 255, 0.94);
	border-bottom: 1px solid var(--line);
	backdrop-filter: blur(10px);
}

.topbar h1,
.section h2,
.login-box h1 {
	margin: 0;
	font-size: 22px;
	line-height: 1.25;
}

.eyebrow {
	margin: 0 0 4px;
	color: var(--muted);
	font-size: 12px;
	text-transform: uppercase;
}

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

.layout {
	width: min(1180px, calc(100% - 32px));
	margin: 20px auto 40px;
	display: grid;
	gap: 16px;
}

.section {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 8px;
	box-shadow: var(--shadow);
	padding: 18px;
}

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

.time-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 12px;
}

.metric {
	min-height: 76px;
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: 12px;
	background: #fbfcfd;
	display: grid;
	align-content: center;
	gap: 6px;
}

.metric span,
.field span,
.switch-row span,
.muted,
.empty-note {
	color: var(--muted);
}

.metric strong {
	font-size: 17px;
	line-height: 1.35;
	word-break: break-word;
}

.settings-grid {
	display: grid;
	grid-template-columns: 1.3fr 0.7fr 0.7fr;
	gap: 14px;
	align-items: end;
}

.field {
	display: grid;
	gap: 7px;
	min-width: 0;
}

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

input[type="text"],
input[type="email"],
input[type="password"],
input[type="time"],
textarea {
	width: 100%;
	min-height: 40px;
	border: 1px solid var(--line-strong);
	border-radius: 6px;
	background: #ffffff;
	color: var(--text);
	padding: 9px 10px;
	outline: none;
}

textarea {
	resize: vertical;
	min-height: 86px;
	line-height: 1.45;
}

input:focus,
textarea:focus {
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.switch-row {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	min-height: 40px;
}

.switch-row.compact {
	min-height: 32px;
}

input[type="checkbox"] {
	width: 18px;
	height: 18px;
	accent-color: var(--primary);
}

.button {
	min-height: 38px;
	border: 1px solid transparent;
	border-radius: 6px;
	padding: 8px 13px;
	cursor: pointer;
	background: #eef2f7;
	color: var(--text);
	transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
	white-space: nowrap;
}

.button:hover {
	background: #e3e8ef;
}

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

.button.primary:hover {
	background: var(--primary-dark);
}

.button.secondary {
	background: #ffffff;
	border-color: var(--line-strong);
}

.button.success {
	background: var(--success);
	color: #ffffff;
}

.button.success:hover {
	background: var(--success-dark);
}

.button.danger {
	background: #fff5f2;
	border-color: #efb7aa;
	color: var(--danger);
}

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

.button.ghost {
	background: transparent;
	border-color: var(--line);
}

.button.full {
	width: 100%;
}

.button:disabled {
	cursor: not-allowed;
	opacity: 0.65;
}

.status-pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 30px;
	border: 1px solid var(--line);
	border-radius: 999px;
	padding: 5px 10px;
	background: #f8fafc;
	color: var(--muted);
	font-size: 13px;
}

.status-pill.running {
	border-color: rgba(183, 121, 31, 0.35);
	background: #fff8eb;
	color: var(--warning);
}

.status-pill.success {
	border-color: rgba(15, 143, 111, 0.35);
	background: #effaf6;
	color: var(--success);
}

.status-pill.failed {
	border-color: rgba(194, 65, 45, 0.35);
	background: #fff5f2;
	color: var(--danger);
}

.account-list {
	display: grid;
	gap: 12px;
}

.account-row {
	display: grid;
	gap: 12px;
	border: 1px solid var(--line);
	border-radius: 8px;
	padding: 14px;
	background: #fbfcfd;
}

.account-row-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: 38px;
}

.account-summary {
	display: grid;
	gap: 3px;
	min-width: 0;
	margin-right: auto;
}

.account-summary strong {
	font-size: 15px;
	line-height: 1.25;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.account-summary span {
	color: var(--muted);
	font-size: 13px;
}

.account-toggle {
	min-width: 68px;
}

.account-fields {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 12px;
}

.account-row.collapsed .account-fields {
	display: none;
}

.account-fields .wide {
	grid-column: span 2;
}

.empty-note {
	margin: 4px 0 0;
	display: none;
}

.empty-note.visible {
	display: block;
}

.logs-section {
	min-height: 280px;
}

.log-output {
	margin: 0;
	min-height: 240px;
	max-height: 420px;
	overflow: auto;
	border: 1px solid #1f2933;
	border-radius: 8px;
	background: #151a21;
	color: #d7ffe9;
	padding: 14px;
	font-size: 13px;
	line-height: 1.55;
	white-space: pre-wrap;
	word-break: break-word;
}

.toast {
	position: fixed;
	right: 20px;
	bottom: 20px;
	max-width: min(420px, calc(100% - 40px));
	min-height: 42px;
	padding: 11px 14px;
	border: 1px solid var(--line);
	border-radius: 8px;
	background: var(--panel);
	box-shadow: var(--shadow);
	color: var(--text);
	opacity: 0;
	transform: translateY(8px);
	pointer-events: none;
	transition: opacity 0.16s ease, transform 0.16s ease;
}

.toast.visible {
	opacity: 1;
	transform: translateY(0);
}

.toast.error {
	border-color: #efb7aa;
	color: var(--danger);
}

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

.login-shell {
	width: min(420px, 100%);
}

.login-box {
	display: grid;
	gap: 16px;
	padding: 24px;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 8px;
	box-shadow: var(--shadow);
}

.form-error {
	margin: 0;
	color: var(--danger);
}

@media (max-width: 920px) {
	.settings-grid,
	.account-fields,
	.time-grid {
		grid-template-columns: 1fr;
	}

	.field.wide,
	.account-fields .wide {
		grid-column: span 1;
	}
}

@media (max-width: 640px) {
	.topbar {
		position: static;
		align-items: flex-start;
		padding: 16px;
	}

	.topbar,
	.section-heading {
		flex-direction: column;
	}

	.topbar-actions,
	.button-row,
	.section-heading,
	.account-row-head {
		align-items: stretch;
		width: 100%;
	}

	.account-row-head {
		flex-direction: column;
	}

	.account-summary {
		width: 100%;
	}

	.button,
	.topbar-actions form {
		width: 100%;
	}

	.layout {
		width: calc(100% - 20px);
		margin-top: 10px;
	}
}
