:root {
	--bg: #0d1117;
	--surface: #161b22;
	--surface-alt: #1c232e;
	--border: #30363d;
	--text: #e6edf3;
	--muted: #8b949e;
	--accent: #4f8cff;
	--accent-hover: #6ea0ff;
	--danger: #f85149;
	--success: #3fb950;
	--warning: #d29922;
	--radius: 8px;
}

* {
	box-sizing: border-box;
}

html, body {
	margin: 0;
	padding: 0;
	background: var(--bg);
	color: var(--text);
	font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	min-height: 100%;
}

a {
	color: var(--accent);
	text-decoration: none;
}
a:hover {
	color: var(--accent-hover);
	text-decoration: underline;
}

.site-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 28px;
	border-bottom: 1px solid var(--border);
	background: var(--surface);
}

.site-nav .brand {
	font-weight: 700;
	font-size: 1.1rem;
	color: var(--text);
}
.site-nav .brand:hover {
	text-decoration: none;
	color: var(--accent);
}

.site-nav .links {
	display: flex;
	align-items: center;
	gap: 18px;
}

.site-nav .links span.user-tag {
	color: var(--muted);
	font-size: 0.9rem;
}

.badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 600;
	border: 1px solid var(--border);
}
.badge-user { color: var(--muted); }
.badge-admin { color: var(--accent); border-color: var(--accent); }
.badge-superadmin { color: var(--warning); border-color: var(--warning); }

.container {
	max-width: 1000px;
	margin: 0 auto;
	padding: 32px 24px 64px;
}

.container.narrow {
	max-width: 440px;
}

.container.medium {
	max-width: 700px;
}

h1, h2, h3 {
	color: var(--text);
	font-weight: 600;
}

.subtitle {
	color: var(--muted);
	margin-top: -8px;
}

.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 24px;
	margin-bottom: 20px;
}

.card-flush {
	padding: 0;
	overflow: hidden;
}

.hero {
	text-align: center;
	padding: 64px 24px 40px;
}

.hero h1 {
	font-size: 2.2rem;
	margin-bottom: 8px;
}

.hero p {
	color: var(--muted);
	font-size: 1.05rem;
	max-width: 560px;
	margin: 0 auto 28px;
}

.hero .actions {
	display: flex;
	justify-content: center;
	gap: 12px;
}

.stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 16px;
	max-width: 700px;
	margin: 0 auto 40px;
}

.stat-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 20px;
	text-align: center;
}

.stat-card .value {
	font-size: 2rem;
	font-weight: 700;
	color: var(--accent);
}

.stat-card .label {
	color: var(--muted);
	font-size: 0.85rem;
	margin-top: 4px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.btn {
	display: inline-block;
	padding: 9px 18px;
	border-radius: var(--radius);
	border: 1px solid var(--border);
	background: var(--surface-alt);
	color: var(--text);
	font-size: 0.9rem;
	font-weight: 600;
	cursor: pointer;
}
.btn:hover {
	border-color: var(--accent);
	text-decoration: none;
}

.btn-primary {
	background: var(--accent);
	border-color: var(--accent);
	color: #fff;
}
.btn-primary:hover {
	background: var(--accent-hover);
	border-color: var(--accent-hover);
}

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

.btn-small {
	padding: 5px 12px;
	font-size: 0.8rem;
}

.notification-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 0;
	border-bottom: 1px solid var(--border);
}
.notification-item:last-child {
	border-bottom: none;
}
.notification-item .notification-info .type {
	color: var(--muted);
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
.notification-item .notification-actions {
	display: flex;
	gap: 8px;
	align-items: center;
}

.oauth-buttons {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 4px;
}

.oauth-divider {
	display: flex;
	align-items: center;
	color: var(--muted);
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin: 18px 0;
}
.oauth-divider::before,
.oauth-divider::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--border);
}
.oauth-divider::before { margin-right: 12px; }
.oauth-divider::after { margin-left: 12px; }

.btn-oauth {
	width: 100%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	text-align: center;
	color: #fff;
}
.oauth-icon {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}
.btn-discord {
	background: #5865f2;
	border-color: #5865f2;
}
.btn-discord:hover {
	background: #4752c4;
	border-color: #4752c4;
}
.btn-roblox {
	background: #000;
	border-color: #000;
}
.btn-roblox:hover {
	background: #333;
	border-color: #333;
}

.linked-account-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 0;
	border-top: 1px solid var(--border);
}
.linked-account-row:first-of-type {
	border-top: none;
}
.linked-account-row .btn-oauth {
	width: auto;
}

form label {
	display: block;
	margin-bottom: 6px;
	font-size: 0.85rem;
	color: var(--muted);
}

form .field {
	margin-bottom: 16px;
}

input, select, textarea {
	width: 100%;
	padding: 9px 12px;
	border-radius: var(--radius);
	border: 1px solid var(--border);
	background: var(--bg);
	color: var(--text);
	font-size: 0.95rem;
	font-family: inherit;
}
input:focus, select:focus, textarea:focus {
	outline: none;
	border-color: var(--accent);
}

.showcase-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 20px;
	margin-bottom: 20px;
}

.showcase-tile {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	overflow: hidden;
}

.showcase-tile img {
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	display: block;
}

.showcase-tile-body {
	padding: 16px;
}

.showcase-tile-body h4 {
	margin: 0 0 4px;
}

.showcase-tile-creator {
	color: var(--muted);
	font-size: 0.8rem;
	margin-bottom: 8px;
}

.showcase-tile-body p {
	color: var(--muted);
	font-size: 0.9rem;
	margin: 0 0 12px;
}

.showcase-tile-link {
	display: inline-block;
	font-size: 0.85rem;
	margin-bottom: 8px;
}

.showcase-tile-clicks {
	color: var(--muted);
	font-size: 0.75rem;
	margin-bottom: 8px;
}

.showcase-tile-actions {
	display: flex;
	gap: 8px;
}

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

table th, table td {
	text-align: left;
	padding: 12px 16px;
	border-bottom: 1px solid var(--border);
	font-size: 0.9rem;
}

table th {
	color: var(--muted);
	font-weight: 600;
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	background: var(--surface-alt);
}

table tr:last-child td {
	border-bottom: none;
}

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

.error-banner {
	background: rgba(248, 81, 73, 0.12);
	border: 1px solid var(--danger);
	color: #ffb4ae;
	padding: 10px 14px;
	border-radius: var(--radius);
	margin-bottom: 16px;
	display: none;
}

.success-banner {
	background: rgba(63, 185, 80, 0.12);
	border: 1px solid var(--success);
	color: #9be7a5;
	padding: 10px 14px;
	border-radius: var(--radius);
	margin-bottom: 16px;
	display: none;
}

.page-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 20px;
}

.checkbox-label {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 16px;
	color: var(--muted);
	font-size: 0.9rem;
	cursor: pointer;
}
.checkbox-label input {
	width: auto;
}

.acct-number {
	font-family: "Cascadia Code", Consolas, monospace;
	font-size: 1.2rem;
	color: var(--accent);
	letter-spacing: 0.06em;
}

.dot {
	display: inline-block;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	margin-right: 8px;
}

.footer {
	text-align: center;
	color: var(--muted);
	font-size: 0.8rem;
	padding: 24px;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
	margin-top: 32px;
	margin-bottom: 12px;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--border);
}
.markdown-body h1:first-child,
.markdown-body h2:first-child {
	margin-top: 0;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol {
	color: var(--text);
	line-height: 1.65;
}

.markdown-body a {
	color: var(--accent);
}

.markdown-body code {
	font-family: "Cascadia Code", Consolas, monospace;
	background: var(--surface-alt);
	border: 1px solid var(--border);
	border-radius: 4px;
	padding: 2px 6px;
	font-size: 0.85em;
}

.markdown-body pre {
	background: var(--surface-alt);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 16px;
	overflow-x: auto;
}
.markdown-body pre code {
	background: none;
	border: none;
	padding: 0;
	font-size: 0.85rem;
	line-height: 1.5;
}

.markdown-body table {
	margin: 16px 0 24px;
}

.markdown-body img {
	max-width: 100%;
	height: auto;
	display: block;
	border-radius: var(--radius);
	border: 1px solid var(--border);
	margin: 16px 0;
}

.markdown-body blockquote {
	margin: 16px 0;
	padding: 4px 16px;
	border-left: 3px solid var(--accent);
	color: var(--muted);
}

/* ---- RoSocket additions (server-rendered banners, CSP-safe utilities) ---- */

.error-banner.visible,
.success-banner.visible {
	display: block;
}

.btn-block {
	width: 100%;
}

.inline-form {
	display: inline;
	margin: 0;
}

.link-button {
	background: none;
	border: none;
	padding: 0;
	color: var(--accent);
	font: inherit;
	cursor: pointer;
}
.link-button:hover {
	color: var(--accent-hover);
	text-decoration: underline;
}

.row-form {
	display: flex;
	gap: 12px;
	align-items: flex-end;
}
.row-form .field {
	flex: 1;
	margin-bottom: 0;
}

.token-reveal {
	font-family: "Cascadia Code", Consolas, monospace;
	background: var(--bg);
	border: 1px solid var(--success);
	border-radius: var(--radius);
	padding: 10px 12px;
	word-break: break-all;
	user-select: all;
	margin: 10px 0 0;
}

.mono {
	font-family: "Cascadia Code", Consolas, monospace;
	font-size: 0.85rem;
}

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

.dot-open { background: var(--success); }
.dot-connecting { background: var(--warning); }
.dot-closed { background: var(--danger); }

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

.detail-cell {
	max-width: 360px;
	word-break: break-all;
}

.pager {
	display: flex;
	justify-content: flex-end;
	margin-top: 12px;
}

.danger-zone {
	border-color: var(--danger);
}

.checkbox-label.spaced {
	margin: 12px 0;
}

.page-header form,
form .checkbox-label {
	margin-bottom: 12px;
}

.filter-form {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 24px;
	margin-bottom: 12px;
}
