:root {
	--bg: #0e1016;
	--bg-elev: #161a24;
	--bg-elev-2: #1d2230;
	--border: #262c3b;
	--text: #e6e9f0;
	--muted: #8b93a7;
	--accent: #7c6cff;
	--accent-2: #a78bfa;
	--good: #34d399;
	--warn: #fbbf24;
	--bad: #f87171;
	--radius: 12px;
	--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
	--sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: light) {
	:root {
		--bg: #f5f6fa;
		--bg-elev: #ffffff;
		--bg-elev-2: #f0f1f6;
		--border: #e2e5ee;
		--text: #1a1d27;
		--muted: #6b7280;
	}
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
	background: var(--bg);
	color: var(--text);
	font-family: var(--sans);
	font-size: 15px;
	line-height: 1.5;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
code { font-family: var(--mono); font-size: 0.9em; }

/* ---- Login ---- */
.login {
	position: fixed; inset: 0;
	display: grid; place-items: center;
	background: radial-gradient(1200px 600px at 50% -10%, rgba(124, 108, 255, 0.18), transparent 70%), var(--bg);
	padding: 24px;
}
.login-card {
	width: 100%; max-width: 360px;
	background: var(--bg-elev);
	border: 1px solid var(--border);
	border-radius: 16px;
	padding: 28px;
	display: flex; flex-direction: column; gap: 14px;
}
.login-card .brand { font-size: 20px; }
.login-card p { margin: 0 0 4px; }

/* ---- Brand ---- */
.brand { font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.brand-mark { color: var(--accent); }

/* ---- Topbar ---- */
.topbar {
	position: sticky; top: 0; z-index: 5;
	display: flex; align-items: center; justify-content: space-between;
	padding: 14px 22px;
	background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--border);
}
.topbar-right { display: flex; align-items: center; gap: 10px; }

/* ---- Layout ---- */
.wrap { max-width: 1040px; margin: 0 auto; padding: 28px 22px 80px; }
.section { margin-bottom: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0; font-weight: 600; }

/* ---- Workspaces ---- */
.ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.ws-card {
	background: var(--bg-elev); border: 1px solid var(--border);
	border-radius: var(--radius); padding: 16px 18px;
}
.ws-card .name { font-weight: 600; }
.ws-card .slug { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 2px; }
.ws-card .count { margin-top: 10px; font-size: 13px; color: var(--muted); }

/* ---- Table ---- */
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table thead th {
	text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em;
	color: var(--muted); font-weight: 600; padding: 12px 16px; background: var(--bg-elev-2);
	border-bottom: 1px solid var(--border);
}
.table tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { background: var(--bg-elev); }
.repo-name { font-family: var(--mono); font-weight: 600; }
.repo-name a { color: var(--text); text-decoration: none; border-bottom: 1px dotted var(--muted); }
.branch { font-family: var(--mono); font-size: 13px; }
.labels { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
	font-family: var(--mono); font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
	background: color-mix(in srgb, var(--accent) 16%, transparent);
	color: var(--accent-2); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}
.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); }

/* ---- Pills / status ---- */
.pill {
	font-family: var(--mono); font-size: 12px; padding: 4px 10px; border-radius: 999px;
	border: 1px solid var(--border); background: var(--bg-elev-2); color: var(--muted);
	display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.pill.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.pill.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---- Buttons ---- */
button { font-family: inherit; font-size: 14px; cursor: pointer; border-radius: 9px; border: 1px solid transparent; padding: 8px 14px; transition: background 0.12s, border-color 0.12s, opacity 0.12s; }
button:disabled { opacity: 0.55; cursor: default; }
.primary { background: var(--accent); color: #fff; font-weight: 600; }
.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.ghost:hover { background: var(--bg-elev-2); }
.danger-link { background: none; border: none; color: var(--bad); padding: 4px 6px; font-size: 13px; }
.danger-link:hover { text-decoration: underline; }

/* ---- Forms ---- */
input, select {
	font-family: inherit; font-size: 14px; color: var(--text);
	background: var(--bg-elev-2); border: 1px solid var(--border);
	border-radius: 9px; padding: 10px 12px; width: 100%;
}
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; border-color: var(--accent); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
label input, label select { margin-top: 2px; }

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(0,0,0,0.55); padding: 20px; }
.modal-card {
	width: 100%; max-width: 460px; background: var(--bg-elev);
	border: 1px solid var(--border); border-radius: 16px; padding: 22px;
	display: flex; flex-direction: column; gap: 14px; max-height: 90vh; overflow-y: auto;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.hint { margin: 0; }

/* ---- Error / toast ---- */
.error {
	background: color-mix(in srgb, var(--bad) 14%, transparent);
	border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent);
	color: var(--bad); padding: 10px 12px; border-radius: 9px; font-size: 13px;
	white-space: pre-wrap; word-break: break-word;
}
.toast {
	position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
	background: var(--bg-elev-2); border: 1px solid var(--border); color: var(--text);
	padding: 12px 18px; border-radius: 10px; z-index: 30; box-shadow: 0 8px 30px rgba(0,0,0,0.35);
	font-size: 14px;
}
.toast.good { border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.toast.bad { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }

.spin { display: inline-block; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
