:root {
	--bg: #0a0a0a;
	--surface: #141414;
	--surface-hover: #1a1a1a;
	--border: #2a2a2a;
	--text: #e5e5e5;
	--text-muted: #888;
	--primary: #6366f1;
	--primary-hover: #818cf8;
	--danger: #ef4444;
	--success: #22c55e;
	--warning: #eab308;
	--info: #3b82f6;
	--radius: 8px;
	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}
body {
	font-family: var(--font);
	background: var(--bg);
	color: var(--text);
	line-height: 1.6;
}

.container {
	max-width: 960px;
	margin: 0 auto;
	padding: 2rem 1rem;
}

.navbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 2rem;
	border-bottom: 1px solid var(--border);
	background: var(--surface);
}
.navbar .logo {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--primary);
	text-decoration: none;
}
.nav-links {
	display: flex;
	gap: 1rem;
	align-items: center;
}
.nav-links a {
	color: var(--text-muted);
	text-decoration: none;
	font-size: 0.875rem;
}
.nav-links a:hover {
	color: var(--text);
}

.hero {
	text-align: center;
	padding: 4rem 0;
}
.hero h1 {
	font-size: 3rem;
	margin-bottom: 0.5rem;
}
.hero p {
	color: var(--text-muted);
	font-size: 1.125rem;
	margin-bottom: 2rem;
}

.btn {
	display: inline-block;
	padding: 0.5rem 1rem;
	border-radius: var(--radius);
	border: 1px solid var(--border);
	cursor: pointer;
	font-size: 0.875rem;
	text-decoration: none;
	color: var(--text);
	background: var(--surface);
	transition: background 0.15s;
}
.btn:hover {
	background: var(--surface-hover);
}
.btn-primary {
	background: var(--primary);
	border-color: var(--primary);
	color: #fff;
}
.btn-primary:hover {
	background: var(--primary-hover);
}
.btn-secondary {
	background: var(--surface);
	border-color: var(--border);
}
.btn-danger {
	background: var(--danger);
	border-color: var(--danger);
	color: #fff;
}
.btn-sm {
	padding: 0.25rem 0.5rem;
	font-size: 0.75rem;
}
.btn-link {
	background: none;
	border: none;
	color: var(--text-muted);
	cursor: pointer;
	font-size: 0.875rem;
}
.btn-link:hover {
	color: var(--text);
}

.form {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	max-width: 480px;
}
.form label {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	font-size: 0.875rem;
	color: var(--text-muted);
}
.form input,
.form textarea,
.form select {
	padding: 0.5rem 0.75rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text);
	font-size: 0.875rem;
}
.form input:focus,
.form textarea:focus,
.form select:focus {
	outline: none;
	border-color: var(--primary);
}
.form small {
	color: var(--text-muted);
	font-size: 0.75rem;
}

.auth-form {
	max-width: 400px;
	margin: 2rem auto;
}
.divider {
	text-align: center;
	color: var(--text-muted);
	margin: 1rem 0;
	position: relative;
}
.divider::before,
.divider::after {
	content: "";
	position: absolute;
	top: 50%;
	width: 40%;
	height: 1px;
	background: var(--border);
}
.divider::before {
	left: 0;
}
.divider::after {
	right: 0;
}

.grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 1rem;
}
.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1.25rem;
	transition: border-color 0.15s;
}
.card:hover {
	border-color: var(--primary);
}
.card h3 {
	margin-bottom: 0.5rem;
}
.card p {
	color: var(--text-muted);
	font-size: 0.875rem;
	margin-bottom: 0.75rem;
}
.card-actions {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.75rem;
}

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

.badge {
	display: inline-block;
	padding: 0.125rem 0.5rem;
	border-radius: 999px;
	font-size: 0.75rem;
	background: var(--surface-hover);
	border: 1px solid var(--border);
}
.badge-warning {
	border-color: var(--warning);
	color: var(--warning);
}
.badge-info {
	border-color: var(--info);
	color: var(--info);
}
.badges {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.error {
	color: var(--danger);
	font-size: 0.875rem;
	padding: 0.5rem;
	border: 1px solid var(--danger);
	border-radius: var(--radius);
}
.success {
	color: var(--success);
	font-size: 0.875rem;
	padding: 0.5rem;
	border: 1px solid var(--success);
	border-radius: var(--radius);
}

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

.endpoint {
	display: block;
	padding: 0.75rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	font-family: monospace;
	font-size: 0.875rem;
	word-break: break-all;
	margin-bottom: 1rem;
}

.subtitle {
	color: var(--text-muted);
	margin-bottom: 1.5rem;
}

.checkbox-label {
	flex-direction: row !important;
	gap: 0.5rem !important;
	align-items: center;
}

fieldset {
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}
fieldset legend {
	color: var(--text-muted);
	font-size: 0.875rem;
	padding: 0 0.5rem;
}

.badge-success {
	border-color: var(--success);
	color: var(--success);
}

.connection-status {
	margin: 0.75rem 0;
	padding: 0.5rem 0;
}

.auth-status {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.text-muted {
	color: var(--text-muted);
	font-size: 0.875rem;
}

.capabilities-container {
	margin-top: 0.75rem;
}

.capabilities {
	padding: 0.75rem;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	font-size: 0.875rem;
}
.capabilities h4 {
	margin: 0.5rem 0 0.25rem;
	font-size: 0.875rem;
	color: var(--text-muted);
}
.capabilities ul {
	list-style: none;
	padding-left: 0;
}
.capabilities li {
	padding: 0.25rem 0;
	border-bottom: 1px solid var(--border);
}
.capabilities li:last-child {
	border-bottom: none;
}

.form-actions {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.5rem;
}

/* HTMX loading indicators */
.htmx-indicator {
	display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
	display: inline-block;
}

/* Disable button styling while request is in-flight */
button[disabled],
.btn[disabled] {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
}

/* Inline spinner for loading indicators */
.spinner {
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 2px solid var(--border);
	border-top-color: var(--primary);
	border-radius: 50%;
	animation: spin 0.6s linear infinite;
	vertical-align: middle;
	margin-right: 0.25rem;
}

@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}

/* Loading placeholder inside targets */
.loading-msg {
	color: var(--text-muted);
	font-size: 0.875rem;
	padding: 0.5rem 0;
}

/* Connection guide */
.connection-guide {
	margin: 0.75rem 0;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
}
.connection-guide summary {
	padding: 0.5rem 0.75rem;
	cursor: pointer;
	font-size: 0.875rem;
	color: var(--text-muted);
	background: var(--surface);
	user-select: none;
}
.connection-guide summary:hover {
	color: var(--text);
}
.connection-guide .guide-content {
	padding: 0.75rem;
}
.connection-guide h4 {
	font-size: 0.875rem;
	margin: 0.75rem 0 0.25rem;
}
.connection-guide h4:first-child {
	margin-top: 0;
}
.code-block {
	display: block;
	padding: 0.75rem;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	font-family: monospace;
	font-size: 0.8rem;
	white-space: pre;
	overflow-x: auto;
	margin-bottom: 0.5rem;
}

/* Error message styling (from error middleware) */
.error-message {
	color: var(--danger);
	font-size: 0.875rem;
	padding: 0.5rem;
	border: 1px solid var(--danger);
	border-radius: var(--radius);
	margin-top: 0.5rem;
}
