/* The admin pages ("global settings"): lists inside cards, small forms, the translation editor. */

/* ---- the admin part of the settings menu ---- */

.set-nav-admin {
	margin-top: 8px;
	padding-top: 12px;
	border-top: 1px solid var(--border);
}

.set-nav-admin-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 4px 10px 10px;
	font-size: calc(13px * var(--ui-scale));
	font-weight: 600;
	color: var(--text-strong);
}

.set-admin-badge {
	margin-left: 0;
	background: var(--danger-bg);
	color: var(--danger);
	font-size: calc(11px * var(--ui-scale));
	font-weight: 500;
}

/* ---- shared ---- */

.set-error {
	margin: 6px 0 0;
	font-size: calc(12px * var(--ui-scale));
	color: var(--danger);
	overflow-wrap: anywhere;
}

.set-ok {
	margin: 6px 0 0;
	font-size: calc(12px * var(--ui-scale));
	color: var(--ok);
}

.set-stack.is-busy {
	opacity: 0.7;
	transition: opacity 0.2s var(--ease);
}

.adm-banner {
	margin: 0 0 16px;
	padding: 10px 12px;
	border-radius: var(--radius);
	background: color-mix(in srgb, #f59e0b 12%, transparent);
}

.adm-form > .input {
	flex: 1 1 140px;
	min-width: 0;
	width: auto;
}

.adm-form > .set-select {
	flex: none;
	width: auto;
}

/* `.set-inline .input` stretches every input; these stay small */
.set-inline .input.adm-short,
.set-inline .input.adm-num,
.set-inline .input.adm-face-input {
	flex: none;
	min-width: 0;
}

.adm-short {
	width: 7em;
}

.adm-num {
	width: 6.5em;
}

.adm-textarea {
	resize: vertical;
	min-height: 2.6em;
}

.adm-mono,
.adm-link,
.adm-code {
	font-family: var(--mono);
	overflow-wrap: anywhere;
}

.adm-code {
	font-size: calc(16px * var(--ui-scale));
	letter-spacing: 0.04em;
	color: var(--text-strong);
}

.adm-link {
	font-size: calc(12px * var(--ui-scale));
	color: var(--text);
}

.adm-struck {
	text-decoration: line-through;
}

.adm-copy.is-done {
	color: var(--ok);
}

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

.adm-actions-split {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.adm-actions-split .btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

/* ---- lists inside a card ---- */

.adm-list {
	padding-top: 0;
}

.adm-item {
	padding: 10px 0;
}

.adm-item + .adm-item {
	border-top: 1px dashed var(--border);
}

.adm-item.is-current .adm-item-title {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.adm-item-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	min-width: 0;
}

.adm-item-title {
	font-weight: 500;
	color: var(--text-strong);
	overflow-wrap: anywhere;
}

.adm-item-side {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-left: auto;
	font-size: calc(12px * var(--ui-scale));
	color: var(--muted);
}

.adm-item-actions {
	margin-top: 8px;
	gap: 6px;
}

.adm-item-actions .btn,
.adm-item-actions a.btn {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	text-decoration: none;
}

.adm-badge {
	margin-left: 0;
	padding: 0 7px;
	font-size: calc(11px * var(--ui-scale));
}

.adm-badge.is-admin {
	background: var(--surface-2);
	color: var(--text-strong);
}

.adm-badge.is-ok {
	background: var(--ok-bg);
	color: var(--ok);
}

/* ---- check boxes and pills ---- */

.adm-checks {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
}

.adm-check {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: calc(13px * var(--ui-scale));
	color: var(--text);
	overflow-wrap: anywhere;
}

.adm-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.adm-pill {
	padding: 3px 10px;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--surface);
	color: var(--text);
	font: inherit;
	font-size: calc(12px * var(--ui-scale));
	cursor: pointer;
}

.adm-pill:hover {
	background: var(--surface-2);
}

.adm-pill.is-on {
	border-color: var(--accent);
	background: var(--accent);
	color: var(--accent-text);
}

/* ---- accounts: the invite just made ---- */

.adm-invite {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	padding: 12px;
	border: 1px dashed var(--border-strong);
	border-radius: var(--radius);
}

.adm-qr {
	flex: none;
	width: 150px;
	height: 150px;
}

.adm-qr svg {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 6px;
}

.adm-invite-text {
	display: flex;
	flex: 1 1 220px;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.adm-dismiss {
	align-self: flex-start;
	margin-top: 4px;
}

.adm-invite-state.is-ok {
	color: var(--ok);
}

.adm-invite-state.is-used {
	color: var(--muted);
}

.adm-invite-state.is-expired {
	color: var(--faint);
	text-decoration: line-through;
}

/* ---- providers ---- */

.adm-fields {
	margin-top: 10px;
	gap: 10px;
}

/* ---- agent avatars ---- */

.adm-face-main {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
}

.adm-face-text {
	flex: 1;
	min-width: 0;
}

.adm-face-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}

.adm-face-actions > .input,
.adm-face-actions > .btn {
	height: 38px;
}

.adm-face-input {
	width: 4.5em;
	text-align: center;
}

.adm-face-actions .set-select {
	flex: none;
	width: auto;
}

/* ---- reasoning ---- */

.adm-expand {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.adm-expand-text {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
	overflow-wrap: anywhere;
}

.adm-expand-arrow {
	display: inline-flex;
	color: var(--faint);
	transition: transform 0.2s var(--ease);
}

.adm-expand-arrow.is-open {
	transform: rotate(90deg);
}

.adm-levels {
	margin-top: 12px;
}

.adm-level {
	display: grid;
	grid-template-columns: 7.5em 1fr auto;
	align-items: center;
	gap: 4px 10px;
}

.adm-level .field-hint-error {
	grid-column: 2 / 4;
}

.adm-level .field-hint-error:empty {
	display: none;
}

/* ---- preset prompts ---- */

.adm-prompt {
	display: flex;
	gap: 8px;
}

.adm-prompt-fields {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.adm-prompt-tools {
	display: flex;
	flex-direction: column;
}

/* ---- built-in tools ---- */

.adm-quota {
	gap: 8px;
}

.adm-quota-label {
	flex: none;
	min-width: 4em;
	font-size: calc(12px * var(--ui-scale));
	color: var(--muted);
}

/* ---- translations ---- */

.adm-tr-editor {
	scroll-margin-top: 16px;
}

.adm-tr-tools {
	margin: 10px 0 8px;
}

.adm-tr-tools > .input[type="search"] {
	flex: 1 1 200px;
	width: auto;
}

.adm-tr-tools > .set-select {
	flex: none;
	width: auto;
}

/* Stays in view while scrolling the long list, so saving is always one click away. */
.adm-tr-bar {
	position: sticky;
	top: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
	margin: 10px 0;
	padding: 8px 0;
	background: var(--surface);
}

.adm-tr-entry {
	padding: 10px 0;
}

.adm-tr-entry + .adm-tr-entry {
	border-top: 1px dashed var(--border);
}

.adm-tr-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}

.adm-tr-key {
	font-family: var(--mono);
	font-size: calc(12px * var(--ui-scale));
	color: var(--muted);
	overflow-wrap: anywhere;
}

.adm-tr-ref {
	margin: 4px 0;
	font-size: calc(12px * var(--ui-scale));
	color: var(--faint);
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.adm-tr-input {
	width: 100%;
	resize: vertical;
}

.adm-tr-input.is-dirty {
	border-color: var(--accent);
	box-shadow: 0 0 0 1px var(--accent);
}

.adm-issues ul {
	margin: 4px 0 0;
	padding-left: 18px;
}

@media (max-width: 767px) {
	.adm-level {
		grid-template-columns: 1fr auto;
	}

	.adm-level .input {
		grid-column: 1 / 3;
		grid-row: 2;
	}

	.adm-level .field-hint-error {
		grid-column: 1 / 3;
	}

}

/* ---- 品牌与外观 (admin/branding.js) ---- */

.adm-brand-slot {
	align-items: center;
}

/* a picture on the background of its theme */
.adm-brand-preview {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 120px;
	height: 48px;
	padding: 6px 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: #fff;
	color: #111827;
}

.adm-brand-preview.is-dark {
	background: #111827;
	color: #f9fafb;
}

.adm-brand-preview img {
	max-width: 200px;
	max-height: 100%;
	object-fit: contain;
}

.adm-brand-preview-text {
	min-width: 0;
	background: var(--sb-card-bg);
	color: var(--text-strong);
	font-size: calc(15px * var(--ui-scale));
}

.adm-brand-text {
	flex: 1;
	min-width: 0;
	max-width: 280px;
}

.adm-brand-count {
	font-variant-numeric: tabular-nums;
}

.adm-brand-style {
	width: 38px;
	padding-inline: 0;
	font-family: Georgia, "Times New Roman", serif;
}

.adm-brand-bold {
	font-weight: 800;
}

.adm-brand-italic {
	font-style: italic;
}

.adm-brand-underline {
	text-decoration: underline;
}

.adm-brand-style[aria-pressed="true"] {
	border-color: var(--accent);
	box-shadow: inset 0 0 0 1px var(--accent);
	color: var(--accent);
}

.adm-brand-link {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
	gap: 8px;
	align-items: center;
}

@media (max-width: 767px) {
	.adm-brand-link {
		grid-template-columns: minmax(0, 1fr) auto;
	}

	.adm-brand-link .adm-brand-link-url {
		grid-column: 1;
		grid-row: 2;
	}
}

/* ---- 部署 (admin/deploy.js) ---- */

.adm-deploy-facts {
	display: grid;
	gap: 6px;
	margin: 10px 0;
}

.adm-deploy-fact {
	display: grid;
	grid-template-columns: 90px minmax(0, 1fr);
	gap: 8px;
	align-items: baseline;
}

.adm-deploy-checks {
	display: grid;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.adm-deploy-checks li {
	display: flex;
	gap: 8px;
	align-items: flex-start;
}

.adm-deploy-checks svg {
	flex: none;
	margin-top: 3px;
}

.adm-deploy-checks .is-ok svg {
	color: var(--ok, #16a34a);
}

.adm-deploy-checks .is-warn svg {
	color: var(--warn, #d97706);
}

.adm-deploy-conf-wrap {
	position: relative;
}

.adm-deploy-conf {
	margin: 0;
	max-height: 420px;
	overflow: auto;
	padding: 12px 14px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface-2);
	font-size: calc(12.5px * var(--ui-scale));
	line-height: 1.5;
	tab-size: 4;
	white-space: pre;
}

.adm-deploy-conf-tools {
	display: flex;
	align-items: center;
	gap: 6px;
	justify-content: flex-end;
	margin-top: 8px;
}

.adm-deploy-conf-tools > span {
	display: flex;
}

.adm-deploy-steps {
	display: grid;
	gap: 4px;
	margin: 0;
	padding-left: 20px;
}

/* a whole command on its own lines under its step: long, so it wraps anywhere; one click selects it all */
.adm-deploy-cmd {
	display: block;
	margin-top: 4px;
	overflow-wrap: anywhere;
	white-space: pre-wrap;
	user-select: all;
}

/* the built-in https proxy: a red bar per problem, at the top of its card */
.adm-proxy-alert {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	margin-top: 10px;
	padding: 10px 12px;
	border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
	border-radius: var(--radius);
	background: var(--danger-bg);
	color: var(--danger);
	font-size: calc(13px * var(--ui-scale));
}

.adm-proxy-alert > svg {
	flex: none;
	margin-top: 2px;
}

.adm-proxy-alert-text {
	display: grid;
	flex: 1;
	gap: 6px;
	min-width: 0;
	overflow-wrap: anywhere;
}

.adm-proxy-alert-text .set-code {
	color: var(--text);
}

.adm-proxy-alert-more {
	font-size: calc(12px * var(--ui-scale));
}

/* the command to type, and a button to copy it */
.adm-proxy-cmd {
	display: flex;
	gap: 8px;
	align-items: flex-start;
}

.adm-proxy-cmd > code {
	flex: 1;
	min-width: 0;
	margin-top: 0;
}

.adm-proxy-state {
	display: inline-flex;
	gap: 8px;
	align-items: center;
}

.adm-proxy-dot {
	flex: none;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--muted);
}

.adm-proxy-dot.is-on {
	background: var(--ok);
}

.adm-proxy-log {
	max-height: 260px;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

/* the mark beside the domain's name, the button level with the whole entry */
.adm-proxy-certs svg {
	margin-top: 5px;
}

.adm-proxy-cert {
	display: flex;
	flex: 1;
	flex-wrap: wrap;
	gap: 2px 10px;
	align-items: baseline;
	min-width: 0;
	overflow-wrap: anywhere;
}

.adm-proxy-certs .btn {
	flex: none;
	align-self: center;
}
