:root {
	color-scheme: light;
	--bg: #f4f4f1;
	--panel: #fbfbf8;
	--border: #1f1f1f;
	--muted-border: #cfcfc8;
	--text: #171717;
	--subtle: #5a5a55;
	--accent: #111111;
	--accent-foreground: #f8f8f5;
}

* {
	box-sizing: border-box;
	transition: all 0.2s ease;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: #333; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb:hover { background: #555; cursor: default; }
::-webkit-scrollbar-corner { background: #333; }
::-webkit-resizer { margin: 0; }

body {
	margin: 0;
	min-height: 100vh;
	font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
	color: var(--text);
	background: var(--bg);
	overflow-y: scroll;
	overflow-x: hidden;
}

#page {
	width: 100%;
	padding: 64px 10px;
}

#page.hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.panel {
	width: min(860px, 100%);
	margin: 0 auto;
	background: var(--panel);
	border: 1px solid var(--muted-border);
	padding: 32px;
	box-shadow: 8px 8px 0 rgba(17, 17, 17, 0.06);
}

.info-panel {
	width: min(860px, 100%);
	margin: 30px auto 0;
	padding: 24px 32px;
	border: 1px solid var(--muted-border);
	background: rgba(255, 255, 255, 0.92);
	box-shadow: 8px 8px 0 rgba(17, 17, 17, 0.04);
}

.info-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 14px;
}

.info-section {
	padding: 0;
	border: 0;
	background: transparent;
}

.info-section h3 {
	margin: 0 0 10px;
	font-size: 0.92rem;
	font-weight: 600;
	color: var(--text);
}

.info-list {
	margin: 0;
	padding: 0;
	list-style: none;
	color: var(--subtle);
	line-height: 1.7;
}

.info-list li {
	position: relative;
	padding-left: 20px;
	font-size: 0.92rem;
}

.info-list li::before {
	content: "-";
	position: absolute;
	left: 8px;
	top: 0;
	color: var(--subtle);
	font-weight: 700;
}

.info-list li + li {
	margin-top: 8px;
}

.hero h1 {
	margin: 6px 0 12px;
	font-family: "Times New Roman", serif;
	font-size: clamp(2rem, 4vw, 2.8rem);
	font-weight: 600;
}

.eyebrow {
	margin: 0;
	font-size: 0.82rem;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--subtle);
}

.summary {
	margin: 0 0 28px;
	max-width: 680px;
	line-height: 1.7;
	color: var(--subtle);
}

.showcase-entry {
	margin: 12px 0 0;
	font-size: 0.95rem;
	color: var(--subtle);
}

.showcase-entry.hidden {
	display: none;
}

.showcase-entry a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.showcase-entry a:hover {
	color: var(--text);
}

.form,
.status-card,
.results-card {
	border: 1px solid var(--muted-border);
	padding: 20px;
	background: #fff;
}

.status-card,
.results-card {
	margin-top: 18px;
}

.upload-box {
	display: block;
	padding: 22px;
	border: 1px dashed var(--border);
	cursor: pointer;
	background: #fcfcfa;
}

.upload-box.dragover {
	border-color: var(--accent);
	background: #f2f2ed;
	box-shadow: inset 0 0 0 1px var(--accent);
}

.upload-box input {
	display: none;
}

.upload-title {
	display: block;
	margin-bottom: 6px;
	font-weight: 600;
}

.upload-subtitle {
	display: block;
	color: var(--subtle);
}

.row {
	display: grid;
	gap: 14px;
	margin-top: 18px;
}

.two-columns {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-actions-row {
	grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto;
	align-items: end;
}

.field {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
}

.quality-row {
	grid-template-columns: fit-content(100%) minmax(0, 1fr);
	align-items: end;
}

.quality-field {
	width: fit-content;
	max-width: 100%;
	justify-self: start;
}

.quality-api-field {
	opacity: 1;
}

.form-actions-row > .primary-button {
	width: fit-content;
	justify-self: start;
}

.quality-api-field.is-muted {
	opacity: 0.45;
}

.field span,
.label {
	font-size: 0.92rem;
	color: var(--subtle);
}

.field-label-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
}

.field-hint {
	font-size: 0.82rem;
	white-space: nowrap;
	text-align: right;
}

select,
input,
.primary-button {
	min-height: 35px;
	border-radius: 0;
	border: 1px solid var(--border);
	font: inherit;
}

select,
input {
	padding: 0 12px;
	background: #fff;
	outline: none;
}

input::placeholder {
	color: var(--subtle);
}

.primary-button {
	margin: 0;
	padding: 0 18px;
	background: var(--accent);
	color: var(--accent-foreground);
	cursor: pointer;
}

.primary-button:disabled {
	opacity: 0.55;
	cursor: wait;
}

.secondary-button {
	min-height: 35px;
	padding: 0 16px;
	border: 1px solid var(--border);
	background: #fff;
	color: var(--text);
	font: inherit;
	cursor: pointer;
}

.secondary-button:disabled {
	opacity: 0.55;
	cursor: wait;
}

.quality-toggle {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	align-items: center;
	width: fit-content;
	height: 35px;
	padding: 0 2.5px;
	border: 1px solid var(--border);
	background: #fff;
	overflow: hidden;
}

.quality-option {
	margin: 0;
	padding: 0 15px;
	height: 28px;
	border: 0;
	border-right: 1px solid var(--muted-border);
	background: transparent;
	color: var(--subtle);
	font: inherit;
	cursor: pointer;
}

.quality-option:last-child {
	border-right: 0;
}

.quality-option:hover {
	background: #f2f2ed;
	color: var(--text);
}

.quality-option:focus-visible {
	position: relative;
	outline: none;
	box-shadow: inset 0 0 0 1px var(--border);
	z-index: 1;
}

.quality-option.is-active {
	background: var(--accent);
	color: var(--accent-foreground);
}

.quality-option.is-active:hover {
	background: var(--accent);
	color: var(--accent-foreground);
}

.status-line {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.status-label-group {
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
}

.status-progress-text {
	color: var(--subtle);
	font-size: 0.92rem;
}

.phase-progress {
	margin-top: 14px;
}

.pipeline-track {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.pipeline-segment {
	position: relative;
	height: 8px;
	overflow: hidden;
	background: #ecece6;
	border: 1px solid #d9d9d2;
}

.pipeline-segment.is-active {
	border-color: var(--border);
}

.segment-fill {
	display: block;
	width: 0;
	height: 100%;
	background: var(--accent);
}

.results-list {
	margin: 14px 0 0;
	padding: 0;
	list-style: none;
}

.results-list li + li {
	margin-top: 10px;
}

.result-link {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	padding: 12px 14px;
	border: 1px solid var(--muted-border);
	color: inherit;
	text-decoration: none;
}

.result-link:hover {
	border-color: var(--border);
}

.empty {
	color: var(--subtle);
	font-size: 0.92rem;
}

.empty .showcase-entry {
	display: inline;
}

.hidden-block {
	display: none;
}

.empty-text {
	color: var(--subtle);
	font-size: 0.92rem;
}

.op-shell {
	width: min(1180px, 100%);
}

.op-page {
	padding-top: 40px;
	padding-bottom: 40px;
}

.op-hero {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	align-items: flex-start;
}

.op-session-actions {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	justify-content: flex-end;
}

.op-session-status {
	font-size: 0.92rem;
	color: var(--subtle);
}

.op-login-row,
.op-inline-form {
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: end;
}

.op-content {
	display: grid;
	gap: 18px;
	margin-top: 18px;
}

.op-toolbar {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.op-stat-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 14px;
	margin-top: 16px;
}

.op-stat-card,
.op-subcard {
	padding: 16px;
	border: 1px solid var(--muted-border);
	background: #fff;
}

.op-stat-label {
	display: block;
	font-size: 0.9rem;
	color: var(--subtle);
	margin-bottom: 8px;
}

.op-stat-value {
	font-size: 1.8rem;
	font-weight: 600;
}

.op-quota-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px;
	margin-top: 16px;
	margin-bottom: 16px;
}

.op-subcard h3 {
	margin: 0 0 12px;
	font-size: 1rem;
}

.op-created-key {
	margin: 12px 0 0;
	word-break: break-all;
}

.op-table-wrapper {
	margin-top: 16px;
	overflow-x: auto;
	border: 1px solid var(--muted-border);
	background: #fff;
}

.op-table {
	width: 100%;
	border-collapse: collapse;
	min-width: 860px;
}

.op-table th,
.op-table td {
	padding: 10px 12px;
	border-bottom: 1px solid #ecece6;
	text-align: left;
	font-size: 0.92rem;
	vertical-align: middle;
}

.op-table th {
	background: #f8f8f5;
	color: var(--subtle);
	font-weight: 600;
	white-space: nowrap;
}

.op-table-form {
	display: flex;
	gap: 8px;
	align-items: center;
}

.op-table-form input {
	width: 120px;
}

.empty-cell {
	text-align: center;
	color: var(--subtle);
}

@media (max-width: 720px) {
	.page {
		padding: 24px 14px;
	}

	.panel {
		padding: 20px;
	}

	.two-columns,
	.form-actions-row {
		grid-template-columns: 1fr;
	}

	.quality-row {
		grid-template-columns: 1fr;
	}

	.op-hero,
	.op-login-row,
	.op-inline-form,
	.op-quota-grid,
	.op-stat-grid {
		grid-template-columns: 1fr;
		display: grid;
	}

	.op-hero {
		display: grid;
	}

	.info-panel {
		padding: 22px 20px;
	}

	.pipeline-track {
		gap: 4px;
	}
}
