/* uni-auth 共享样式 */
@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
	color-scheme: light;
	--ink: #17251f;
	--ink-soft: #64736b;
	--paper: #f7f8f2;
	--panel: rgba(255, 255, 252, .88);
	--line: #dce4db;
	--mint: #b9e7ce;
	--mint-strong: #2d9b68;
	--coral: #ef725f;
	--button: #3a6651;
	--button-hover: #2f5744;
	--shadow: 0 24px 70px rgba(25, 55, 41, .12);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body {
	min-height: 100vh;
	margin: 0;
	padding: 48px 20px;
	color: var(--ink);
	font-family: "Manrope", "Avenir Next", sans-serif;
	background:
		radial-gradient(circle at 9% 8%, rgba(185, 231, 206, .7), transparent 25rem),
		radial-gradient(circle at 96% 90%, rgba(239, 114, 95, .14), transparent 28rem),
		var(--paper);
}
body::before {
	position: fixed;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	opacity: .3;
	content: "";
	background-image: linear-gradient(rgba(23, 37, 31, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(23, 37, 31, .035) 1px, transparent 1px);
	background-size: 32px 32px;
	mask-image: linear-gradient(to bottom, black, transparent 72%);
}
main {
	position: relative;
	width: min(440px, 100%);
	margin: 0 auto;
	padding: clamp(28px, 5vw, 48px);
	border: 1px solid rgba(255, 255, 255, .8);
	border-radius: 24px;
	background: var(--panel);
	box-shadow: var(--shadow);
	backdrop-filter: blur(18px);
	animation: rise .55s ease both;
}
body.page-admin main { width: min(1120px, 100%); }
.admin-topbar { position: absolute; top: 26px; right: 34px; z-index: 1; }
.admin-topbar form { margin: 0; }
.logout-button { width: auto; margin: 0; padding: 8px 12px; font-size: .78rem; }
h1, h2, h3, p { margin-top: 0; }
.eyebrow { margin-bottom: 14px; color: var(--mint-strong); font-size: .68rem; font-weight: 800; letter-spacing: .16em; line-height: 1.4; text-transform: uppercase; }
h1 { margin-bottom: 10px; font-size: clamp(1.7rem, 4vw, 2.35rem); line-height: 1.05; letter-spacing: -.04em; }
h2 { margin-bottom: 14px; font-size: 1.05rem; letter-spacing: -.02em; }
h3 { margin: 22px 0 10px; font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); }
p { line-height: 1.65; }
body.page-admin main::before {
	display: block;
	margin-bottom: 8px;
	color: var(--mint-strong);
	font-size: .72rem;
	font-weight: 800;
	letter-spacing: .16em;
	text-transform: uppercase;
	content: "CONTROL ROOM / UNI-AUTH";
}
input, button, textarea {
	display: block;
	width: 100%;
	margin: 10px 0;
	padding: 13px 14px;
	border: 1px solid var(--line);
	border-radius: 11px;
	color: var(--ink);
	font: inherit;
	font-size: .95rem;
	background: rgba(255, 255, 255, .72);
	transition: border-color .2s, box-shadow .2s, transform .2s, background .2s;
}
input:focus, textarea:focus { outline: 0; border-color: var(--mint-strong); box-shadow: 0 0 0 4px rgba(45, 155, 104, .14); background: #fff; }
button { border: 0; color: #fff; cursor: pointer; font-weight: 700; background: var(--button); }
button:hover { transform: translateY(-1px); background: var(--button-hover); }
button:active { transform: translateY(0); }
button:disabled { cursor: wait; opacity: .6; transform: none; }
.save-button, .action-dialog #action-dialog-confirm { color: #fff; background: #287653; }
.save-button:hover, .action-dialog #action-dialog-confirm:hover { background: #1f6245; }
textarea { min-height: 78px; resize: vertical; }
form button + button, .muted-btn { color: var(--ink-soft); background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
form button + button:hover, .muted-btn:hover { color: var(--ink); background: #eef4ed; }
.err { min-height: 1.3em; margin: 14px 0 0; color: #bf4939; font-size: .88rem; }
.muted { color: var(--ink-soft); font-size: .86rem; }
.auth-step { animation: step-in .3s ease both; }
.auth-step-totp { position: relative; }
.step-back { display: inline-flex; width: auto; margin: -4px 0 28px; padding: 0; color: var(--ink-soft); font-size: .82rem; font-weight: 700; background: transparent; box-shadow: none; }
.step-back:hover { color: var(--ink); background: transparent; box-shadow: none; transform: translateX(-2px); }
.admin-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 32px 0 4px; padding: 6px; border: 1px solid var(--line); border-radius: 16px; background: rgba(232, 240, 232, .68); }
.admin-tab { display: flex; min-height: 68px; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; margin: 0; padding: 12px 16px; border: 1px solid transparent; border-radius: 11px; color: var(--ink-soft); text-align: left; background: transparent; box-shadow: none; }
.admin-tab:hover { color: var(--ink); background: rgba(255, 255, 255, .58); transform: none; }
.admin-tab[aria-selected="true"] { border-color: rgba(45, 155, 104, .25); color: var(--ink); background: #fff; box-shadow: 0 5px 14px rgba(25, 55, 41, .08); }
.admin-tab span { font-size: .94rem; font-weight: 800; }
.admin-tab small { font-size: .72rem; font-weight: 500; }
.admin-panel { animation: panel-in .3s ease both; }
.admin-panel > section:first-child { margin-top: 32px; }
.admin-subtabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-top: 26px; padding: 4px; border-bottom: 1px solid var(--line); background: rgba(232, 240, 232, .46); }
.admin-subtab { min-height: 56px; margin: 0; padding: 9px 12px; border-radius: 8px 8px 0 0; color: var(--ink-soft); text-align: left; background: transparent; box-shadow: none; }
.admin-subtab:hover { color: var(--ink); background: rgba(255, 255, 255, .65); transform: none; }
.admin-subtab[aria-selected="true"] { color: var(--ink); background: #fff; box-shadow: inset 0 -3px 0 var(--mint-strong); }
.admin-subtab span, .admin-subtab small { display: block; }
.admin-subtab span { font-size: .84rem; font-weight: 800; }
.admin-subtab small { margin-top: 3px; font-size: .67rem; font-weight: 500; }
.admin-subpanel { animation: panel-in .25s ease both; }
.admin-subpanel section { margin-top: 0; border-top: 0; }
#totp-svg { width: min(180px, 100%); margin: 18px auto; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
#totp-svg svg { display: block; width: 100% !important; height: auto !important; }
.edit-dialog { width: 520px; max-width: calc(100% - 28px); margin: auto; padding: 30px; border: 1px solid rgba(255, 255, 255, .9); border-radius: 20px; color: var(--ink); background: #fbfcf8; box-shadow: 0 28px 90px rgba(20, 47, 34, .24); }
.edit-dialog::backdrop { background: rgba(20, 42, 31, .38); backdrop-filter: blur(5px); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.dialog-heading .eyebrow { margin-bottom: 8px; }
.dialog-heading h2 { margin-bottom: 0; font-size: 1.45rem; }
.dialog-close { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; margin: -4px -4px 0 0; padding: 0; border-radius: 50%; color: var(--ink-soft); font-size: 1.35rem; font-weight: 500; line-height: 1; background: transparent; box-shadow: none; }
.dialog-close:hover { color: var(--ink); background: #eef4ed; transform: none; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.dialog-actions button { margin: 0; }
.secret-field { display: flex; align-items: center; gap: 8px; }
.secret-field input { min-width: 0; flex: 1; }
.redirect-uri-list { display: grid; gap: 2px; }
.redirect-uri-row { display: flex; align-items: center; gap: 6px; }
.redirect-uri-row input { min-width: 0; flex: 1; }
.redirect-uri-row .field-action { width: 36px; height: 36px; flex: 0 0 36px; margin: 10px 0; padding: 0; font-size: 1.2rem; line-height: 1; }
.redirect-uri-row .field-action:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.field-action { width: auto; flex: 0 0 auto; margin: 10px 0; padding: 11px 12px; color: var(--ink-soft); font-size: .78rem; white-space: nowrap; background: #eef4ed; box-shadow: inset 0 0 0 1px var(--line); }
.field-action:hover { color: var(--ink); background: #e3eee4; }
.action-dialog { width: 430px; max-width: calc(100% - 28px); margin: auto; padding: 30px; border: 1px solid rgba(255, 255, 255, .9); border-radius: 20px; color: var(--ink); background: #fbfcf8; box-shadow: 0 28px 90px rgba(20, 47, 34, .24); }
.action-dialog::backdrop { background: rgba(20, 42, 31, .38); backdrop-filter: blur(5px); }
.action-dialog h2 { margin-bottom: 8px; font-size: 1.4rem; }
.action-dialog-message { margin-bottom: 20px; }
.action-dialog input { margin-top: 18px; }
.action-dialog input[hidden] { display: none; }
.dialog-danger { color: #fff !important; background: var(--coral) !important; }
.dialog-danger:hover { background: #d85d4b !important; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 30px; }
.app-heading { margin-top: 0; margin-bottom: 18px; }
.app-heading h2 { margin: 0; }
.profile-heading { margin-top: 0; margin-bottom: 22px; }
.profile-heading h2 { margin-bottom: 6px; }
.profile-heading p { margin-bottom: 0; }
.profile-subpanel { width: min(760px, 100%); margin: 0 auto; }
.profile-edit-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; min-height: 28px; }
.profile-edit-toolbar .step-back { margin: -4px 0 0; }
.profile-save { width: auto; margin: -4px 0 0; padding: 10px 14px; font-size: .82rem; }
.profile-view { display: grid; width: min(620px, 100%); margin: 0 auto; border-top: 1px solid var(--line); }
.profile-field { display: grid; grid-template-columns: 130px 1fr; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.profile-field > span { color: var(--ink-soft); font-size: .78rem; font-weight: 700; }
.profile-field strong { min-width: 0; overflow-wrap: anywhere; font-size: .95rem; font-weight: 600; }
#profile-f { width: min(620px, 100%); margin: 0 auto; }
.profile-form-message { width: min(620px, 100%); margin: 14px auto 0; }
.section-heading h3 { margin: 0 0 4px; }
.section-heading p { margin-bottom: 0; }
.compact-action { width: auto; flex: 0 0 auto; margin: 0; padding: 10px 14px; font-size: .82rem; }
section { margin: 34px 0 0; padding-top: 28px; border-top: 1px solid var(--line); }
section:first-of-type { margin-top: 28px; }
table { width: 100%; margin: 12px 0; border-collapse: separate; border-spacing: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
th { padding: 10px 12px; color: var(--ink-soft); font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-align: left; text-transform: uppercase; background: rgba(232, 240, 232, .55); }
td { padding: 13px 12px; border-top: 1px solid var(--line); vertical-align: middle; font-size: .84rem; line-height: 1.5; }
tr:first-child td { border-top: 0; }
td button { display: inline-block; width: auto; margin: 0 4px 0 0; padding: 7px 10px; font-size: .77rem; }
#pk-list { table-layout: fixed; }
#pk-list th:nth-child(1), #pk-list td:nth-child(1) { width: 38%; }
#pk-list th:nth-child(2), #pk-list td:nth-child(2) { width: 31%; }
#pk-list th:nth-child(3), #pk-list td:nth-child(3) { width: 31%; text-align: left; }
.table-actions { display: flex; align-items: center; justify-content: flex-start; gap: 6px; }
.table-actions button { margin: 0; }
#cl-list { table-layout: fixed; }
#cl-list th:nth-child(1), #cl-list td:nth-child(1) { width: 16%; }
#cl-list th:nth-child(2), #cl-list td:nth-child(2) { width: 21%; }
#cl-list th:nth-child(3), #cl-list td:nth-child(3) { width: 30%; word-break: break-word; }
#cl-list th:nth-child(4), #cl-list td:nth-child(4) { width: 15%; }
#cl-list th:nth-child(5), #cl-list td:nth-child(5) { width: 18%; text-align: left; }
code, pre { font-family: "DM Mono", monospace; }
code { font-size: .78rem; word-break: break-all; }
pre { max-height: 460px; padding: 18px; overflow: auto; white-space: pre-wrap; word-break: break-all; border-radius: 12px; background: #192a23; color: #d6f0df; }
ul { padding-left: 22px; line-height: 2; }
body.page-confirm main { border-top: 5px solid var(--mint-strong); }
body.page-confirm .confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
body.page-confirm .confirm-actions form { width: auto; }
body.page-confirm .confirm-actions form button { margin-top: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes step-in { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: translateX(0); } }
@keyframes panel-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (max-width: 680px) {
	body { padding: 20px 12px; }
	main { padding: 28px 22px; border-radius: 18px; }
	body.page-admin main { padding: 26px 18px; }
	.admin-topbar { top: 20px; right: 18px; }
	.admin-tabs { margin-top: 26px; }
	.admin-tab { min-height: 62px; padding: 10px; }
	.admin-tab small { font-size: .66rem; }
	.admin-subtabs { margin-top: 20px; }
	.admin-subtab { min-height: 58px; padding: 8px 7px; }
	.admin-subtab small { font-size: .6rem; }
	.edit-dialog { padding: 24px 20px; }
	.action-dialog { padding: 24px 20px; }
	.secret-field { align-items: stretch; flex-direction: column; gap: 0; }
	.field-action { width: 100%; margin-top: 0; }
	.section-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
	.profile-heading { align-items: stretch; }
	.profile-field { grid-template-columns: 96px 1fr; gap: 12px; }
	.compact-action { width: 100%; }
	body.page-admin table { display: block; overflow-x: auto; white-space: nowrap; }
	body.page-confirm .confirm-actions { grid-template-columns: 1fr 1fr; }
	body.page-confirm .confirm-actions form { width: auto; }
}

@media (prefers-color-scheme: dark) {
	:root {
		color-scheme: dark;
		--ink: #e4f0e7;
		--ink-soft: #9bb3a5;
		--paper: #101814;
		--panel: rgba(24, 38, 31, .9);
		--line: #30483b;
		--mint: #214e39;
		--mint-strong: #5dcc91;
		--coral: #f18773;
		--button: #315542;
		--button-hover: #3d6750;
		--shadow: 0 24px 70px rgba(0, 0, 0, .34);
	}
	html { background: var(--paper); }
	body {
		background:
			radial-gradient(circle at 9% 8%, rgba(45, 155, 104, .18), transparent 25rem),
			radial-gradient(circle at 96% 90%, rgba(239, 114, 95, .1), transparent 28rem),
			var(--paper);
	}
	body::before {
		opacity: .22;
		background-image: linear-gradient(rgba(200, 230, 211, .055) 1px, transparent 1px), linear-gradient(90deg, rgba(200, 230, 211, .055) 1px, transparent 1px);
	}
	main { border-color: rgba(220, 245, 229, .12); }
	input, button, textarea { background: rgba(27, 46, 37, .82); }
	input:focus, textarea:focus { background: #1a2d23; }
	button:hover { background: #345542; }
	.save-button, .action-dialog #action-dialog-confirm { background: #3f966b; }
	.save-button:hover, .action-dialog #action-dialog-confirm:hover { background: #347d59; }
	form button + button:hover, .muted-btn:hover { color: var(--ink); background: #263d31; }
	.admin-tabs { background: rgba(28, 51, 40, .8); }
	.admin-tab:hover { background: rgba(255, 255, 255, .06); }
	.admin-tab[aria-selected="true"] { background: #21382b; box-shadow: 0 5px 14px rgba(0, 0, 0, .22); }
	.admin-subtabs { background: rgba(28, 51, 40, .62); }
	.admin-subtab:hover { background: rgba(255, 255, 255, .06); }
	.admin-subtab[aria-selected="true"] { background: #21382b; }
	.edit-dialog, .action-dialog { border-color: rgba(220, 245, 229, .16); background: #17251e; box-shadow: 0 28px 90px rgba(0, 0, 0, .5); }
	.dialog-close:hover { background: #263d31; }
	.field-action { background: #263d31; }
	.field-action:hover { background: #31503f; }
	th { background: rgba(38, 66, 51, .72); }
	#totp-svg { background: #fff; }
}
