:root {
	--bg-start: #f5f6ef;
	--bg-end: #dce8f7;
	--ink: #1f2937;
	--card: #ffffffee;
	--line: #c9d3e2;
	--accent: #1d4ed8;
	--accent-hover: #1e40af;
	--success-bg: #ecfdf3;
	--success-text: #166534;
	--error-bg: #fef2f2;
	--error-text: #991b1b;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
	color: var(--ink);
	background: radial-gradient(circle at 15% 15%, #ffffff 0%, transparent 35%), linear-gradient(135deg, var(--bg-start), var(--bg-end));
	min-height: 100vh;
}

main {
	display: flex;
	flex-direction: column;
}

.card {
	max-width: 780px;
	margin: 0 auto;
	width: 100%;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: 18px;
	padding: 28px;
	box-shadow: 0 18px 46px rgba(22, 34, 68, 0.12);
	backdrop-filter: blur(4px);
}

.eyebrow {
	margin: 0 0 8px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #37517e;
}

h1 {
	margin: 0 0 10px;
	font-size: 32px;
	line-height: 1.2;
}

.lead {
	margin: 0 0 20px;
	line-height: 1.55;
}

.template-block {
	margin: 0 0 20px;
	padding: 12px 14px;
	border: 1px dashed var(--line);
	border-radius: 12px;
	background: #f8fbff;
}

.template-block-title {
	margin: 0 0 10px;
	font-weight: 700;
}

.template-links {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.template-link {
	display: inline-block;
	padding: 8px 10px;
	border-radius: 8px;
	background: #e5eefc;
	color: #1e40af;
	text-decoration: none;
	font-weight: 600;
}

.template-link:hover {
	background: #dbe7fb;
}

.upload-form {
	display: grid;
	gap: 16px;
}

.settings-grid {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	margin-bottom: 10px;
}

.readonly-block {
	margin-top: 10px;
	padding: 8px 0;
	border-top: 1px solid var(--line);
}

.readonly-block summary {
	cursor: pointer;
	font-weight: 600;
	color: #1e3a8a;
}

.field {
	display: grid;
	gap: 8px;
}

.field-description {
	font-size: 12px;
	line-height: 1.35;
	color: #475569;
	white-space: pre-line;
}

label {
	font-weight: 700;
}

input[type="file"] {
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 12px;
	background: #fff;
}

input[type="number"] {
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 12px;
	background: #fff;
	max-width: 220px;
}

select {
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 12px;
	background: #fff;
	max-width: 220px;
}

input[readonly],
textarea[readonly] {
	background: #eef2f7;
	color: #64748b;
	border-color: #cbd5e1;
	border-style: solid;
}

input[readonly]:focus,
textarea[readonly]:focus {
	outline: none;
	box-shadow: none;
	border-color: #cbd5e1;
}

.readonly-textarea {
	width: 100%;
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 12px;
	resize: vertical;
	font-family: Consolas, "Courier New", monospace;
	font-size: 12px;
	line-height: 1.4;
}

.actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

button {
	justify-self: start;
	border: 0;
	border-radius: 12px;
	padding: 12px 18px;
	font-size: 16px;
	font-weight: 600;
	color: #fff;
	background: var(--accent);
	cursor: pointer;
	transition:
		transform 0.15s ease,
		background-color 0.15s ease;
}

button:hover:enabled {
	background: var(--accent-hover);
	transform: translateY(-1px);
}

button:disabled {
	opacity: 0.6;
	cursor: default;
}

.button-secondary {
	background: #374151;
}

.button-secondary:hover:enabled {
	background: #1f2937;
}

.notice {
	margin-bottom: 16px;
	padding: 12px 14px;
	border-radius: 10px;
	font-weight: 500;
}

.notice--success {
	background: var(--success-bg);
	color: var(--success-text);
}

.notice--error {
	background: var(--error-bg);
	color: var(--error-text);
}

.notice--progress {
	background: #eef6ff;
	color: #1e3a8a;
	border: 1px solid #bfdbfe;
}

.progress-meta {
	margin-top: 6px;
	font-size: 13px;
	opacity: 0.9;
}

.summary {
	margin: 0 0 14px;
	font-weight: 600;
	color: #1e3a8a;
}

.result-actions-block {
	margin-top: 18px;
	padding: 14px;
	border-radius: 10px;
	border: 1px solid var(--line);
	background: #ffffff;
}

.result-actions-title {
	margin: 0 0 10px;
	font-weight: 600;
}

.result-preview {
	margin-top: 18px;
	width: 100%;
	padding: 0 40px;
	border-radius: 0;
	border: 1px solid var(--line);
	border-left: none;
	border-right: none;
	background: #f8fafc;
	overflow: auto;
	font-size: 13px;
	line-height: 1.45;
	display: flex;
	flex-direction: column;
	align-items: center;
}

.result-preview-title {
	margin: 28px 0 14px 0;
	font-weight: 600;
	color: #1e3a8a;
	padding: 0 20px !important;
}

.result-preview .tabulator {
	border: 1px solid var(--line);
	border-radius: 8px;
	background: #fff;
	width: 100%;
	padding: 0 !important;
	margin-bottom: 28px;
}

.result-preview .codes-cell {
	white-space: pre-line;
	line-height: 1.35;
}

@media (max-width: 640px) {
	.page {
		padding: 26px 14px;
	}

	.card {
		padding: 20px;
	}

	h1 {
		font-size: 26px;
	}

	.result-preview {
		padding: 14px 0;
	}

	.result-preview > * {
		padding: 0 10px;
	}

	.result-preview-title {
		margin: 14px 0 10px 0;
		padding: 0 10px !important;
	}

	.result-preview .tabulator {
		margin-bottom: 14px;
		border-radius: 0;
	}
}
