:root {
	--brand: #2563eb;
	--brand-dark: #1d4ed8;
	--ink: #1e293b;
	--muted: #64748b;
	--line: #e2e8f0;
	--bg-1: #eef2ff;
	--bg-2: #f8fafc;
	--card: #ffffff;
	--radius: 14px;
	--ok: #059669;
	--warn: #d97706;
	--bad:  #dc2626;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
		"PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
	color: var(--ink);
	background:
		radial-gradient(1200px 600px at 0% -10%, var(--bg-1), transparent),
		radial-gradient(900px 500px at 100% 110%, #fce7f3, transparent),
		var(--bg-2);
	min-height: 100vh;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}

/* ---- page shell -------------------------------------------------------- */
.purchase-wrap,
.admin-wrap {
	max-width: 960px;
	margin: 0 auto;
	padding: 32px 20px 60px;
}

.purchase-title,
.admin-title {
	text-align: center;
	font-size: 1.5rem;
	font-weight: 600;
	margin: 0 0 6px;
}

.purchase-subtitle,
.admin-subtitle {
	text-align: center;
	color: var(--muted);
	margin: 0 0 24px;
	font-size: 0.95rem;
}

/* ---- card -------------------------------------------------------------- */
.card {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow:
		0 1px 2px rgba(15, 23, 42, 0.04),
		0 12px 32px -16px rgba(15, 23, 42, 0.18);
	padding: 24px;
	margin-bottom: 20px;
}

.card h2, .card h3 {
	margin: 0 0 14px;
	font-size: 1.05rem;
}

/* ---- notice / callout -------------------------------------------------- */
.notice {
	border-left: 4px solid var(--brand);
	background: #eff6ff;
	border-radius: 8px;
	padding: 12px 16px;
	margin-bottom: 16px;
	color: #334155;
	font-size: 0.92rem;
}
.notice .notice-title { font-weight: 600; color: var(--brand-dark); margin: 0 0 4px; }

/* ---- forms (shared by both purchase + admin) --------------------------- */
.form-row {
	display: grid;
	grid-template-columns: 110px 1fr;
	align-items: center;
	gap: 12px;
	margin: 10px 0;
}
.form-row > label { color: var(--muted); font-size: 0.92rem; text-align: right; }
.form-row input,
.form-row select,
.form-row textarea {
	width: 100%;
	padding: 9px 12px;
	font: inherit;
	color: var(--ink);
	background: #fff;
	border: 1px solid var(--line);
	border-radius: 8px;
	transition: border-color .15s, box-shadow .15s;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
	outline: none;
	border-color: var(--brand);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}
.form-row input:disabled { background: #f1f5f9; color: var(--muted); cursor: not-allowed; }

/* ---- buttons ----------------------------------------------------------- */
.btn,
.btn-primary,
.btn-secondary,
.btn-danger {
	display: inline-block;
	padding: 9px 20px;
	font: inherit;
	font-size: 0.95rem;
	font-weight: 600;
	border-radius: 999px;
	cursor: pointer;
	border: 1px solid transparent;
	transition: transform .1s, box-shadow .2s, opacity .2s;
	text-decoration: none;
}
.btn-primary {
	color: #fff;
	background: linear-gradient(180deg, var(--brand), var(--brand-dark));
	box-shadow: 0 8px 20px -10px rgba(37, 99, 235, 0.6);
}
.btn-secondary {
	color: var(--ink);
	background: #fff;
	border-color: var(--line);
}
.btn-danger {
	color: #fff;
	background: linear-gradient(180deg, #ef4444, #b91c1c);
}
.btn:hover { transform: translateY(-1px); }

/* ---- success banner ---------------------------------------------------- */
.finish {
	display: none;
	text-align: center;
	margin-top: 16px;
	padding: 12px;
	border-radius: 8px;
	background: #ecfdf5;
	color: var(--ok);
	font-weight: 600;
}

/* ---- admin top bar ----------------------------------------------------- */
.admin-topbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 10px 0 16px;
	font-size: 0.9rem;
	color: var(--muted);
}
.admin-topbar a { color: var(--brand); text-decoration: none; }
.admin-topbar a:hover { text-decoration: underline; }

/* ---- admin table ------------------------------------------------------- */
.admin-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.92rem;
}
.admin-table th,
.admin-table td {
	padding: 8px 10px;
	text-align: left;
	border-bottom: 1px solid var(--line);
}
.admin-table th {
	background: #f8fafc;
	font-weight: 600;
	color: var(--muted);
	font-size: 0.82rem;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}
.admin-table tbody tr:hover { background: #f8fafc; }

/* ---- badges ------------------------------------------------------------ */
.badge {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 999px;
	font-size: 0.78rem;
	font-weight: 600;
}
.badge.ok    { background: #d1fae5; color: var(--ok); }
.badge.warn  { background: #fef3c7; color: var(--warn); }
.badge.bad   { background: #fee2e2; color: var(--bad);  }
.badge.muted { background: #e2e8f0; color: var(--muted); }

/* ---- pre / license blob ------------------------------------------------- */
pre.license {
	background: #f4f8ff;
	border: 1px solid #cfe0ff;
	border-radius: 8px;
	padding: 12px;
	font-family: ui-monospace, "Menlo", "Consolas", monospace;
	font-size: 0.85rem;
	white-space: pre-wrap;
	word-break: break-all;
}

/* ---- small screens ----------------------------------------------------- */
@media (max-width: 520px) {
	.purchase-wrap, .admin-wrap { padding: 20px 14px 50px; }
	.card { padding: 18px; }
	.form-row { grid-template-columns: 1fr; gap: 4px; }
	.form-row > label { text-align: left; }
}
