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

body {
	font-family:
		system-ui,
		-apple-system,
		sans-serif;
	background: #f1f5f9;
	color: #1e293b;
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.card {
	background: #fff;
	border-radius: 16px;
	padding: 40px;
	max-width: 420px;
	width: 100%;
	box-shadow: 0 4px 24px rgb(0 0 0 / 0.08);
}

h1 {
	font-size: 1.5rem;
	font-weight: 700;
	margin-bottom: 8px;
}

.sub {
	color: #64748b;
	margin-bottom: 24px;
	line-height: 1.6;
	font-size: 0.95rem;
}

label {
	display: block;
	font-size: 0.875rem;
	font-weight: 500;
	margin-bottom: 6px;
	color: #374151;
}

input[type='email'] {
	width: 100%;
	padding: 10px 14px;
	border: 1.5px solid #e2e8f0;
	border-radius: 8px;
	font-size: 1rem;
	outline: none;
	transition:
		border-color 0.15s,
		box-shadow 0.15s;
}

input[type='email']:focus {
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgb(37 99 235 / 0.12);
}

.btn {
	display: block;
	width: 100%;
	padding: 11px;
	background: #2563eb;
	color: #fff;
	border: none;
	border-radius: 8px;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	text-align: center;
	text-decoration: none;
	transition: background 0.15s;
	margin-top: 16px;
}

.btn:hover {
	background: #1d4ed8;
}

.btn-ghost {
	background: #fff;
	color: #2563eb;
	border: 1.5px solid #2563eb;
}

.btn-ghost:hover {
	background: #eff6ff;
}

.alert {
	padding: 12px 14px;
	border-radius: 8px;
	font-size: 0.875rem;
	margin-bottom: 16px;
}

.alert-error {
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #dc2626;
}

.scope-list {
	list-style: none;
	margin: 16px 0 24px;
}

.scope-list li {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 0;
	border-bottom: 1px solid #f1f5f9;
	font-size: 0.9rem;
	color: #374151;
}

.scope-list li::before {
	content: '✓';
	color: #2563eb;
	font-weight: 700;
	flex-shrink: 0;
}

.muted {
	color: #94a3b8;
	font-size: 0.8rem;
	margin-top: 16px;
	text-align: center;
}

/* ── Admin ── */

body.admin {
	align-items: flex-start;
	justify-content: flex-start;
	background: #f8fafc;
	padding: 0;
}

.admin-wrap {
	width: 100%;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

.admin-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 32px;
	height: 56px;
	background: #fff;
	border-bottom: 1px solid #e2e8f0;
	position: sticky;
	top: 0;
	z-index: 10;
}

.admin-nav {
	display: flex;
	gap: 4px;
	margin-left: 24px;
	flex: 1;
}

.admin-nav-link {
	padding: 6px 12px;
	border-radius: 6px;
	font-size: 0.875rem;
	font-weight: 500;
	color: #64748b;
	text-decoration: none;
	transition: background 0.15s, color 0.15s;
}

.admin-nav-link:hover {
	background: #f1f5f9;
	color: #1e293b;
}

.admin-nav-link.active {
	background: #eff6ff;
	color: #2563eb;
	font-weight: 600;
}

.admin-user-info {
	font-size: 0.875rem;
	color: #64748b;
}

.admin-user-info strong {
	color: #1e293b;
}

.method-badge {
	font-size: 0.75rem;
	font-weight: 700;
	font-family: monospace;
	letter-spacing: 0.05em;
}

.admin-brand {
	text-decoration: none;
	font-weight: 700;
	font-size: 1rem;
	color: #2563eb;
}

.admin-main {
	padding: 32px;
	max-width: 1000px;
	width: 100%;
	margin: 0 auto;
}

.admin-page-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 24px;
}

.admin-page-header h1 {
	margin: 0;
}

.btn-sm {
	width: auto;
	padding: 7px 16px;
	font-size: 0.875rem;
	margin-top: 0;
	display: inline-block;
}

.btn-danger {
	background: #dc2626;
	color: #fff;
}

.btn-danger:hover {
	background: #b91c1c;
}

.btn-warn {
	background: #f59e0b;
	color: #fff;
}

.btn-warn:hover {
	background: #d97706;
}

/* Scope picker chips */

.scope-picker {
	margin-bottom: 4px;
}

.scope-chosen,
.scope-available {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 6px 0;
	min-height: 32px;
}

.scope-available-label {
	margin-top: 12px;
	margin-bottom: 0;
	text-align: left;
	font-size: 0.78rem;
}

.scope-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 8px 4px 10px;
	border-radius: 999px;
	font-size: 0.82rem;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	border: 1px solid transparent;
	cursor: default;
}

.scope-chip code {
	background: transparent;
	color: inherit;
	padding: 0;
	font-family: inherit;
}

.scope-chip-selected {
	background: #dbeafe;
	color: #1e40af;
	border-color: #bfdbfe;
}

.scope-chip-selected button {
	background: none;
	border: none;
	color: #1e40af;
	font-size: 1.05rem;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
	border-radius: 4px;
}

.scope-chip-selected button:hover {
	background: #bfdbfe;
}

.scope-chip-available {
	background: #f1f5f9;
	color: #475569;
	border-color: #e2e8f0;
	cursor: pointer;
	font: inherit;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.scope-chip-available:hover {
	background: #e2e8f0;
	color: #0f172a;
}

.scope-chip-plus {
	color: #94a3b8;
	font-weight: 600;
}

.table-wrap {
	overflow-x: auto;
	border-radius: 10px;
	border: 1px solid #e2e8f0;
	background: #fff;
}

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
}

thead th {
	text-align: center;
	padding: 12px 16px;
	font-size: 0.8rem;
	font-weight: 600;
	color: #64748b;
	border-bottom: 1px solid #e2e8f0;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

tbody td {
	padding: 13px 16px;
	border-bottom: 1px solid #f1f5f9;
	vertical-align: middle;
}

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

.admin-form {
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 28px;
	max-width: 560px;
}

.admin-form label {
	margin-top: 16px;
}

.admin-form label:first-of-type {
	margin-top: 0;
}

.admin-form input[type='text'],
.admin-form input[type='number'],
.admin-form input[type='email'],
.admin-form select,
.admin-form textarea {
	width: 100%;
	padding: 10px 14px;
	border: 1.5px solid #e2e8f0;
	border-radius: 8px;
	font-size: 0.95rem;
	outline: none;
	font-family: inherit;
	background: #fff;
	transition: border-color 0.15s, box-shadow 0.15s;
	resize: vertical;
}

.admin-form select {
	appearance: none;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%2364748b' stroke-width='2'><polyline points='3 5 6 8 9 5'/></svg>");
	background-repeat: no-repeat;
	background-position: right 14px center;
	padding-right: 36px;
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
	border-color: #2563eb;
	box-shadow: 0 0 0 3px rgb(37 99 235 / 0.12);
}

.alert-success {
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	color: #166534;
}

.alert-warn {
	background: #fffbeb;
	border: 1px solid #fde68a;
	color: #92400e;
}

.secret-box {
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	overflow: hidden;
	margin-top: 16px;
}

.secret-row {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 14px 20px;
	border-bottom: 1px solid #f1f5f9;
}

.secret-row:last-child {
	border-bottom: none;
}

.secret-label {
	font-size: 0.8rem;
	font-weight: 600;
	color: #64748b;
	min-width: 110px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.modal {
	border: none;
	border-radius: 14px;
	padding: 0;
	box-shadow: 0 8px 40px rgb(0 0 0 / 0.18);
	max-width: 360px;
	width: 100%;
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	margin: 0;
}

.modal::backdrop {
	background: rgb(0 0 0 / 0.4);
	backdrop-filter: blur(2px);
}

.modal-box {
	padding: 28px;
}

.modal-box h2 {
	font-size: 1.1rem;
	font-weight: 700;
	margin-bottom: 8px;
}

.modal-box p {
	color: #64748b;
	font-size: 0.9rem;
	margin-bottom: 24px;
}

.modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
}

.secret-value {
	color: #2563eb;
	word-break: break-all;
}

.error-issues {
	list-style: none;
	margin: 12px 0 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.error-issues li {
	font-size: 0.85rem;
	color: #dc2626;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 6px;
	padding: 7px 12px;
}

.endpoint-desc {
	font-size: 0.78rem;
	color: #94a3b8;
	margin-top: 3px;
}

.profile-form .profile-avatar {
	margin-bottom: 12px;
}

.tabs-wrap > input[type='radio'] {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.tab-bar {
	display: flex;
	gap: 4px;
	border-bottom: 1px solid #e2e8f0;
	margin-bottom: 20px;
}

.tab-bar label {
	padding: 10px 16px;
	cursor: pointer;
	color: #64748b;
	font-weight: 600;
	font-size: 0.9rem;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
	user-select: none;
}

.tab-bar label:hover {
	color: #0f172a;
}

#home-tab-profile:checked ~ .tab-bar label[for='home-tab-profile'],
#home-tab-teams:checked ~ .tab-bar label[for='home-tab-teams'] {
	color: #2563eb;
	border-bottom-color: #2563eb;
}

.tab-content {
	display: none;
}

.tab-content > p.muted {
	text-align: left;
	margin-top: 0;
	margin-bottom: 16px;
}

/* Language tabs in docs */

.lang-tabs > input[type='radio'] {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.lang-tabs .lang-bar {
	display: flex;
	gap: 4px;
	border-bottom: 1px solid #e2e8f0;
	margin-bottom: 16px;
}

.lang-tabs .lang-bar label {
	padding: 8px 14px;
	cursor: pointer;
	color: #64748b;
	font-weight: 500;
	font-size: 0.85rem;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
	user-select: none;
}

.lang-tabs .lang-bar label:hover {
	color: #0f172a;
}

.lang-tabs > input.lang-js:checked ~ .lang-bar label[data-lang='js'],
.lang-tabs > input.lang-py:checked ~ .lang-bar label[data-lang='py'],
.lang-tabs > input.lang-go:checked ~ .lang-bar label[data-lang='go'] {
	color: #2563eb;
	border-bottom-color: #2563eb;
}

.lang-tabs > input.lang-js:checked ~ .tab-content[data-lang='js'],
.lang-tabs > input.lang-py:checked ~ .tab-content[data-lang='py'],
.lang-tabs > input.lang-go:checked ~ .tab-content[data-lang='go'] {
	display: block;
}

#home-tab-profile:checked ~ .tab-content[data-tab='profile'],
#home-tab-teams:checked ~ .tab-content[data-tab='teams'] {
	display: block;
}

.team-list {
	list-style: none;
	padding: 0;
	margin: 0 0 12px;
}

.team-list li {
	padding: 8px 0;
	border-bottom: 1px solid #f1f5f9;
}

.team-list li:last-child {
	border-bottom: none;
}

.user-avatar-sm {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.user-avatar-sm.user-avatar-placeholder {
	background: #f1f5f9;
	color: #64748b;
	font-weight: 600;
	font-size: 0.85rem;
	border: 1px solid #e2e8f0;
}

.profile-avatar-img,
.profile-avatar-placeholder {
	width: 96px;
	height: 96px;
	border-radius: 50%;
	object-fit: cover;
	border: 1px solid #e2e8f0;
	background: #f1f5f9;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 2rem;
	font-weight: 700;
	color: #64748b;
}

/* ── Docs ── */

.docs-section {
	margin-bottom: 40px;
}

.docs-section h2 {
	font-size: 1.15rem;
	font-weight: 700;
	margin-bottom: 10px;
	padding-bottom: 8px;
	border-bottom: 1px solid #e2e8f0;
}

.docs-intro {
	font-size: 0.9rem;
	color: #475569;
	line-height: 1.7;
	margin-bottom: 20px;
	max-width: 680px;
}

.docs-table-wrap {
	overflow-x: auto;
	border-radius: 10px;
	border: 1px solid #e2e8f0;
	background: #fff;
}

.docs-note {
	font-size: 0.85rem;
	color: #64748b;
	line-height: 1.6;
}

.docs-step {
	margin: 16px 0;
}

.scope-detail {
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	margin-bottom: 10px;
	background: #fff;
}

.scope-detail[open] {
	border-color: #cbd5e1;
}

.scope-detail summary {
	padding: 14px 16px;
	cursor: pointer;
	display: flex;
	align-items: baseline;
	gap: 12px;
	font-size: 0.9rem;
	list-style: none;
	user-select: none;
}

.scope-detail summary::-webkit-details-marker {
	display: none;
}

.scope-detail summary::before {
	content: '▸';
	color: #94a3b8;
	font-size: 0.7rem;
	transition: transform 0.15s;
}

.scope-detail[open] summary::before {
	transform: rotate(90deg);
}

.scope-detail summary code {
	font-weight: 600;
	color: #0f172a;
	background: #f1f5f9;
	padding: 2px 8px;
	border-radius: 4px;
	font-size: 0.85rem;
}

.scope-summary-desc {
	color: #64748b;
	font-weight: 400;
}

.scope-summary-desc code {
	background: transparent;
	color: #475569;
	font-weight: 500;
	padding: 0;
}

.scope-detail-body {
	padding: 0 16px 16px;
	border-top: 1px solid #f1f5f9;
}

.scope-detail-body .docs-note {
	margin: 12px 0;
}

.docs-step-label {
	font-size: 0.85rem;
	font-weight: 600;
	color: #334155;
	margin-bottom: 6px;
}

.docs-section pre {
	background: #0f172a;
	color: #e2e8f0;
	padding: 14px 16px;
	border-radius: 8px;
	overflow-x: auto;
	font-size: 0.8rem;
	line-height: 1.55;
	margin: 0;
}

.docs-section pre code {
	background: transparent;
	color: inherit;
	padding: 0;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.docs-intro code {
	background: #f1f5f9;
	color: #0f172a;
	padding: 1px 6px;
	border-radius: 4px;
	font-size: 0.85em;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
