:root {
	--bg: #0f1117;
	--surface: #1a1d27;
	--border: #2a2d3a;
	--text: #e1e4ed;
	--text-muted: #6b7084;
	--primary: #6c8cff;
	--primary-hover: #8ba4ff;
	--danger: #ff6b6b;
	--danger-hover: #ff8787;
	--success: #51cf66;
	--offline: #ff6b6b;
	--radius: 6px;
}

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

body {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	background: var(--bg);
	color: var(--text);
	line-height: 1.6;
}

header {
	border-bottom: 1px solid var(--border);
	padding: 1rem 2rem;
}

nav {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

nav .logo {
	color: var(--text);
	text-decoration: none;
	font-weight: 700;
	font-size: 1.2rem;
}

nav .nav-logout {
	color: var(--text-muted);
	text-decoration: none;
	font-size: 0.9rem;
}

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

main {
	max-width: 1100px;
	margin: 2rem auto;
	padding: 0 2rem;
}

.servers-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1.5rem;
}

.servers-header h1 {
	font-size: 1.5rem;
	font-weight: 600;
}

.server-table {
	width: 100%;
	border-collapse: collapse;
	background: var(--surface);
	border-radius: var(--radius);
}

.server-table th,
.server-table td {
	padding: 0.75rem 1rem;
	text-align: left;
	border-bottom: 1px solid var(--border);
}

.server-table th {
	background: var(--border);
	font-weight: 600;
	font-size: 0.85rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--text-muted);
}

.server-table td code {
	font-family: 'SF Mono', 'Fira Code', monospace;
	font-size: 0.9rem;
	color: var(--text-muted);
}

.status-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
}

.status-dot.online { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.offline { background: var(--offline); }

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.5rem 1rem;
	border: none;
	border-radius: var(--radius);
	cursor: pointer;
	font-size: 0.9rem;
	font-weight: 500;
	font-family: inherit;
	line-height: 1.4;
	text-decoration: none;
	transition: background 0.15s;
}

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }

.btn-primary {
	background: var(--primary);
	color: #111;
	font-weight: 600;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
	background: var(--border);
	color: var(--text);
}
.btn-secondary:hover { background: #3a3d4a; }

.btn-danger {
	background: transparent;
	color: var(--danger);
	border: 1px solid var(--danger);
}
.btn-danger:hover { background: var(--danger); color: white; }

.btn-warning {
	background: transparent;
	color: #f59f00;
	border: 1px solid #f59f00;
}
.btn-warning:hover { background: #f59f00; color: white; }

.btn-success {
	background: var(--success);
	color: #111;
	font-weight: 600;
}
.btn-success:hover { background: #69db7c; }

.add-form {
	background: var(--surface);
	padding: 1.5rem;
	border-radius: var(--radius);
	margin-bottom: 1.5rem;
	border: 1px solid var(--border);
}

.add-form.hidden { display: none; }

.form-group {
	margin-bottom: 1rem;
	flex: 1;
}

.form-group-sm {
	flex: 0 0 120px;
}

.form-row {
	display: flex;
	gap: 1rem;
}

.form-group label {
	display: block;
	margin-bottom: 0.3rem;
	font-weight: 500;
	font-size: 0.9rem;
}

.form-group input {
	width: 100%;
	padding: 0.5rem 0.75rem;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text);
	font-size: 0.95rem;
}

.form-group input:focus {
	outline: none;
	border-color: var(--primary);
}

.form-actions {
	display: flex;
	gap: 0.75rem;
}

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

.actions-menu {
	position: relative;
	display: inline-block;
}

.actions-toggle {
	min-width: 32px;
	text-align: center;
	font-size: 1.1rem;
	line-height: 1;
	letter-spacing: 2px;
}

.actions-dropdown {
	display: none;
	position: absolute;
	right: 0;
	top: 100%;
	margin-top: 4px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	min-width: 120px;
	z-index: 100;
	box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.actions-dropdown.open { display: block; }

.actions-item {
	display: block;
	width: 100%;
	padding: 0.5rem 0.75rem;
	background: none;
	border: none;
	color: var(--text);
	text-align: left;
	font-size: 0.85rem;
	cursor: pointer;
	text-decoration: none;
}

.actions-item:hover { background: var(--border); }
.actions-item-danger { color: var(--danger); }
.actions-item-danger:hover { background: var(--danger); color: white; }

.empty-state {
	text-align: center;
	padding: 3rem;
	color: var(--text-muted);
	background: var(--surface);
	border-radius: var(--radius);
}

/* Update page */
.update-header {
	display: flex;
	align-items: flex-start;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.update-header h1 {
	font-size: 1.5rem;
	font-weight: 600;
	margin-bottom: 0.25rem;
}

.release-table code {
	font-size: 0.9rem;
}

.release-current {
	background: rgba(108, 140, 255, 0.08);
	border-left: 3px solid var(--primary);
}

.current-marker {
	color: var(--primary);
	font-size: 0.8rem;
	font-weight: 500;
	margin-left: 0.5rem;
}

.badge {
	display: inline-block;
	padding: 0.15rem 0.5rem;
	border-radius: 3px;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	vertical-align: middle;
	margin-left: 0.4rem;
}

.badge-rc { background: #4a3a1a; color: #ffd43b; }
.badge-latest { background: #2a4a2a; color: #51cf66; }

.severity-low { color: var(--text-muted); }
.severity-moderate { color: #ffd43b; }
.severity-severe { color: #ff8c42; }
.severity-critical { color: #ff6b6b; font-weight: 600; }

.flag-list {
	display: flex;
	gap: 0.4rem;
	flex-wrap: wrap;
}

.flag {
	display: inline-block;
	padding: 0.15rem 0.45rem;
	border-radius: 3px;
	font-size: 0.75rem;
	font-weight: 500;
}

.flag-warn {
	background: #4a3a1a;
	color: #ffd43b;
	border: 1px solid #665522;
}

.release-notes-link {
	font-size: 0.85rem;
	color: var(--text-muted);
	cursor: pointer;
	border-bottom: 1px dashed var(--border);
}

.release-notes-link:hover {
	color: var(--text);
}

.modal-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	z-index: 200;
	align-items: center;
	justify-content: center;
}

.modal-overlay.open {
	display: flex;
}

.modal-content {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	width: 90%;
	max-width: 640px;
	max-height: 80vh;
	display: flex;
	flex-direction: column;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 1rem 1.25rem;
	border-bottom: 1px solid var(--border);
}

.modal-header h3 {
	font-size: 1rem;
	font-weight: 600;
	margin: 0;
}

.modal-close {
	background: none;
	border: none;
	color: var(--text-muted);
	font-size: 1.4rem;
	cursor: pointer;
	padding: 0 0.25rem;
	line-height: 1;
}

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

.modal-body {
	padding: 1.25rem;
	overflow-y: auto;
	font-size: 0.9rem;
	line-height: 1.6;
	white-space: pre-wrap;
	font-family: inherit;
	color: var(--text);
	margin: 0;
}

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

.force-seed-label {
	display: flex;
	align-items: center;
	gap: 0.3rem;
	font-size: 0.8rem;
	color: var(--text-muted);
	cursor: pointer;
	white-space: nowrap;
}

.force-seed-label input[type="checkbox"] {
	accent-color: var(--primary);
	cursor: pointer;
}

/* Progress bar */
.progress-modal {
	max-width: 480px;
	width: 90%;
}
.progress-body {
	padding: 1.5rem;
	text-align: center;
}
.progress-bar-track {
	width: 100%;
	height: 8px;
	background: var(--border);
	border-radius: 4px;
	overflow: hidden;
	margin-bottom: 1rem;
}
.progress-bar-fill {
	height: 100%;
	width: 0%;
	background: var(--primary);
	border-radius: 4px;
	transition: width 0.3s ease;
}
.progress-bar-fill.progress-bar-done {
	background: var(--success);
}
.progress-bar-fill.progress-bar-error {
	background: var(--danger);
}
.progress-step {
	font-size: 0.85rem;
	color: var(--text-muted);
	margin-bottom: 0.5rem;
}
.progress-detail {
	font-size: 0.95rem;
	color: var(--text);
}
.progress-error {
	color: var(--danger);
	font-size: 0.85rem;
	word-break: break-word;
}

/* Deploy page */
.deploy-page .deploy-form {
	background: var(--surface);
	padding: 1.5rem;
	border-radius: var(--radius);
	border: 1px solid var(--border);
	margin-bottom: 1.5rem;
}

.deploy-page .form-group small {
	display: block;
	margin-top: 0.3rem;
}

.form-select {
	width: 100%;
	padding: 0.5rem 0.75rem;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text);
	font-size: 0.95rem;
}

.form-select:focus {
	outline: none;
	border-color: var(--primary);
}

.deploy-progress-modal {
	max-width: 540px;
}

.servers-header-actions {
	display: flex;
	gap: 0.75rem;
	align-items: center;
}

/* Access denied splash */
.denied-container {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 100vh;
}

.denied-card {
	text-align: center;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 3rem 4rem;
	max-width: 480px;
}

.denied-icon {
	font-size: 3rem;
	margin-bottom: 1rem;
}

.denied-card h1 {
	margin-bottom: 0.75rem;
	color: var(--text);
}

.denied-card p {
	color: var(--text-muted);
	margin-bottom: 0.5rem;
}

.denied-hint {
	font-size: 0.85rem;
	margin-bottom: 1.5rem !important;
}

.denied-card .btn {
	display: inline-block;
	margin-top: 0.5rem;
}

/* Landing / Login page */
.login-container {
	position: relative;
	width: 100%;
	height: 100vh;
	overflow: hidden;
	background: #000010;
}

.login-bg {
	position: absolute;
	inset: 0;
	background:
		radial-gradient(ellipse at center, rgba(30, 60, 140, 0.25) 0%, transparent 70%),
		radial-gradient(ellipse at 20% 80%, rgba(20, 50, 120, 0.15) 0%, transparent 50%);
}

.login-box {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: rgba(20, 23, 34, 0.9);
	border: 1px solid rgba(255, 255, 255, 0.08);
	padding: 40px 48px;
	border-radius: 8px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
	z-index: 1;
	width: 360px;
	text-align: center;
}

.login-logo {
	width: 120px;
	height: 120px;
	margin: -10px auto 0;
	display: block;
	filter: invert(1);
}

.login-box h2 {
	color: var(--text);
	margin-bottom: 1.5rem;
	font-size: 1.4rem;
	font-weight: 600;
}

.ms-login-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	background-color: #2f2f2f;
	color: #fff;
	font-family: "Segoe UI", Arial, sans-serif;
	font-size: 15px;
	font-weight: 600;
	height: 41px;
	padding: 0 12px;
	border: none;
	border-radius: 0;
	cursor: pointer;
	text-decoration: none;
	transition: background-color 0.2s;
}

.ms-login-button:hover {
	background-color: #1f1f1f;
}

.ms-login-button img {
	width: 20px;
	height: 20px;
}
