/* Visual system aligned to TEP.transmigrasi.go.id / FormulirTEP
   Navy + Antique Gold • Plus Jakarta Sans + Fraunces */

:root {
	--navy-1000: #050e1f;
	--navy-900: #081531;
	--navy-800: #0c1e45;
	--navy-700: #122b5c;
	--navy-600: #1c3c7a;
	--navy-500: #3a5aa0;

	--gold-600: #b38a2b;
	--gold-500: #d4a853;
	--gold-400: #e3c16f;
	--gold-100: #f7eccb;

	--orange: #e66a30;
	--orange-soft: rgba(230, 106, 48, 0.18);

	--ink-900: #0f172a;
	--ink-700: #334155;
	--ink-500: #64748b;
	--ink-300: #cbd5e1;
	--ink-200: #e2e8f0;
	--ink-100: #f1f5f9;
	--ink-50: #f8fafc;

	--danger: #c53030;
	--ok: #0e7c66;

	--radius-lg: 20px;
	--radius: 14px;
	--radius-sm: 10px;
	--touch: 48px;

	--shadow: 0 4px 18px rgba(8, 21, 49, 0.08), 0 1px 2px rgba(8, 21, 49, 0.04);
	--shadow-lg: 0 30px 60px rgba(8, 21, 49, 0.22), 0 10px 20px rgba(8, 21, 49, 0.08);

	--font-sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
	--font-serif: "Fraunces", "Times New Roman", serif;

	--safe-top: env(safe-area-inset-top, 0px);
	--safe-bottom: env(safe-area-inset-bottom, 0px);
	--safe-left: env(safe-area-inset-left, 0px);
	--safe-right: env(safe-area-inset-right, 0px);
	--cta-h: calc(4.7rem + var(--safe-bottom));

	color-scheme: dark;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	min-height: 100dvh;
	font-family: var(--font-sans);
	color: var(--ink-900);
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
	overscroll-behavior-y: contain;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	padding-left: var(--safe-left);
	padding-right: var(--safe-right);
	background:
		radial-gradient(circle at 15% 12%, rgba(230, 106, 48, 0.16), transparent 42%),
		radial-gradient(circle at 88% 78%, rgba(212, 168, 83, 0.14), transparent 46%),
		linear-gradient(165deg, var(--navy-1000) 0%, var(--navy-900) 55%, var(--navy-800) 100%);
}

body::before {
	content: "";
	position: fixed;
	inset: 0;
	pointer-events: none;
	opacity: 0.55;
	background-image: repeating-linear-gradient(
		45deg,
		rgba(255, 255, 255, 0.025) 0 1px,
		transparent 1px 24px
	);
}

a {
	color: var(--gold-400);
}

.app-progress {
	position: sticky;
	top: 0;
	z-index: 40;
	display: grid;
	gap: 0.45rem;
	padding: calc(0.75rem + var(--safe-top)) 1rem 0.7rem;
	background: rgba(5, 14, 31, 0.88);
	backdrop-filter: blur(16px) saturate(1.3);
	border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.progress-meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 0.75rem;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.72);
}

.progress-track {
	height: 6px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.12);
	overflow: hidden;
}

.progress-fill {
	height: 100%;
	width: 0%;
	border-radius: inherit;
	background: linear-gradient(90deg, var(--gold-500), var(--orange));
	transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.shell {
	width: min(880px, 100%);
	margin: 0 auto;
	padding: 1.15rem 1rem calc(var(--cta-h) + 1.4rem);
	position: relative;
	z-index: 1;
}

.hero {
	text-align: center;
	color: #fff;
	padding: 0.4rem 0 1.15rem;
	animation: rise 0.55s ease both;
}

.hero-kicker {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	margin: 0 0 0.95rem;
	padding: 0.4rem 0.85rem;
	border-radius: 999px;
	font-size: 0.68rem;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--gold-400);
	background: rgba(195, 154, 60, 0.12);
	border: 1px solid rgba(195, 154, 60, 0.3);
}

.hero-kicker::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--orange);
	box-shadow: 0 0 0 0 rgba(230, 106, 48, 0.55);
	animation: pulse 2s infinite;
}

.hero h1 {
	margin: 0;
	font-family: var(--font-serif);
	font-weight: 600;
	font-size: clamp(1.85rem, 6.5vw, 2.85rem);
	line-height: 1.12;
	letter-spacing: -0.02em;
	color: #fff;
}

.hero h1 .accent {
	font-style: italic;
	font-weight: 500;
	color: var(--gold-400);
}

.hero-lead {
	margin: 0.95rem auto 0;
	max-width: 58ch;
	color: rgba(255, 255, 255, 0.78);
	font-size: 0.96rem;
}

.scale-legend {
	margin: 1.1rem auto 0;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.45rem;
	max-width: 560px;
}

@media (min-width: 720px) {
	.scale-legend {
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
	}
}

.scale-legend span {
	display: inline-flex;
	align-items: center;
	min-height: 2rem;
	padding: 0.35rem 0.7rem;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.12);
	font-size: 0.76rem;
	color: rgba(255, 255, 255, 0.78);
}

.draft-banner {
	margin: 0 0 0.9rem;
	padding: 0.85rem 0.95rem;
	border-radius: var(--radius);
	background: rgba(212, 168, 83, 0.12);
	border: 1px solid rgba(212, 168, 83, 0.28);
	color: var(--gold-100);
	font-size: 0.9rem;
	display: flex;
	gap: 0.75rem;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
}

.panel {
	position: relative;
	margin-top: 0.95rem;
	padding: 1.25rem 1.05rem 1.3rem;
	background: #fff;
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-lg);
	border: 1px solid rgba(255, 255, 255, 0.08);
	overflow: hidden;
	animation: rise 0.6s ease both;
}

.panel::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	height: 3px;
	background: linear-gradient(90deg, var(--orange), var(--gold-500));
}

@media (min-width: 720px) {
	.panel {
		padding: 1.55rem 1.45rem 1.55rem;
	}
}

.panel h2 {
	margin: 0 0 0.3rem;
	font-family: var(--font-serif);
	font-size: clamp(1.25rem, 4.2vw, 1.45rem);
	font-weight: 600;
	color: var(--navy-900);
}

.panel-intro {
	margin: 0 0 1rem;
	color: var(--ink-500);
	font-size: 0.92rem;
}

.field {
	margin-bottom: 1rem;
}

.field label,
.question-text,
fieldset legend {
	display: block;
	margin-bottom: 0.45rem;
	font-weight: 700;
	font-size: 0.92rem;
	color: var(--navy-900);
}

.field input[type="text"],
.field textarea,
.admin-bar input {
	width: 100%;
	min-height: var(--touch);
	border: 1px solid var(--ink-200);
	border-radius: var(--radius-sm);
	padding: 0.85rem 0.95rem;
	font: inherit;
	font-size: 16px;
	color: var(--ink-900);
	background: #fff;
	transition: border-color 0.18s ease, box-shadow 0.18s ease;
	appearance: none;
}

.field textarea {
	min-height: 120px;
	resize: vertical;
	line-height: 1.45;
}

.field input[type="text"]:focus,
.field textarea:focus,
.admin-bar input:focus {
	outline: none;
	border-color: var(--navy-600);
	box-shadow: 0 0 0 3px rgba(28, 60, 122, 0.15);
}

.choice-grid {
	display: grid;
	gap: 0.5rem;
}

@media (min-width: 720px) {
	.choice-grid.two {
		grid-template-columns: 1fr 1fr;
	}
}

.choice {
	position: relative;
}

.choice input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.choice span {
	display: flex;
	align-items: center;
	min-height: var(--touch);
	padding: 0.85rem 1rem;
	border-radius: var(--radius-sm);
	border: 1px solid var(--ink-200);
	background: #fff;
	cursor: pointer;
	transition: border-color 0.16s ease, background 0.16s ease, transform 0.12s ease;
	font-size: 0.94rem;
	color: var(--ink-700);
}

.choice input:focus-visible + span {
	box-shadow: 0 0 0 3px rgba(28, 60, 122, 0.15);
}

.choice input:checked + span {
	border-color: var(--gold-500);
	background: linear-gradient(180deg, rgba(247, 236, 203, 0.55), rgba(28, 60, 122, 0.06));
	color: var(--navy-900);
	font-weight: 750;
	box-shadow: inset 0 0 0 1px rgba(212, 168, 83, 0.35);
}

.choice:active span {
	transform: scale(0.985);
}

.hidden {
	display: none !important;
}

.question {
	padding: 1rem 0;
	border-top: 1px solid var(--ink-200);
}

.question:first-of-type {
	border-top: 0;
	padding-top: 0.15rem;
}

.question-index {
	display: inline-block;
	margin-right: 0.35rem;
	color: var(--gold-600);
	font-weight: 800;
	font-size: 0.8rem;
}

.likert {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 0.45rem;
	margin-top: 0.7rem;
}

@media (min-width: 640px) {
	.likert {
		grid-template-columns: repeat(6, minmax(0, 1fr));
	}
}

.likert label {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.28rem;
	min-height: var(--touch);
	padding: 0.55rem 0.2rem;
	border-radius: var(--radius-sm);
	border: 1px solid var(--ink-200);
	background: #fff;
	cursor: pointer;
	font-size: 0.82rem;
	font-weight: 800;
	color: var(--ink-500);
	user-select: none;
	transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.likert input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.likert label:has(input:focus-visible) {
	box-shadow: 0 0 0 3px rgba(28, 60, 122, 0.15);
}

.likert label:has(input:checked) {
	border-color: var(--gold-500);
	background: linear-gradient(180deg, rgba(247, 236, 203, 0.7), #fff);
	color: var(--navy-900);
}

.likert label:active {
	transform: scale(0.97);
}

.sticky-cta {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 50;
	padding: 0.75rem 1rem calc(0.75rem + var(--safe-bottom));
	padding-left: calc(1rem + var(--safe-left));
	padding-right: calc(1rem + var(--safe-right));
	background: rgba(5, 14, 31, 0.92);
	backdrop-filter: blur(18px) saturate(1.25);
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.28);
}

.sticky-inner {
	width: min(880px, 100%);
	margin: 0 auto;
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 0.75rem;
	align-items: center;
}

.status {
	min-height: 1.25rem;
	font-size: 0.86rem;
	color: rgba(255, 255, 255, 0.72);
}

.status.error {
	color: #ffb4b4;
}

.status.ok {
	color: #8fe3cf;
}

.btn {
	appearance: none;
	border: 0;
	border-radius: 999px;
	min-height: var(--touch);
	padding: 0.85rem 1.25rem;
	font: inherit;
	font-weight: 800;
	cursor: pointer;
	transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.btn:active {
	transform: scale(0.98);
}

.btn-primary {
	background: linear-gradient(135deg, var(--navy-700) 0%, var(--navy-900) 100%);
	color: #fff;
	box-shadow: 0 12px 28px -8px rgba(8, 21, 49, 0.55);
	min-width: 9.5rem;
	border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-primary:disabled {
	opacity: 0.62;
	cursor: wait;
	transform: none;
}

.btn-ghost {
	background: transparent;
	color: inherit;
	border: 1px solid currentColor;
	opacity: 0.9;
}

.draft-banner .btn-ghost,
.success-card .btn-ghost {
	color: var(--navy-800);
	border-color: var(--ink-200);
	background: #fff;
}

.success-card {
	text-align: center;
	padding: 2rem 1.1rem;
	color: var(--ink-900);
}

.success-card .hero-kicker {
	color: var(--gold-600);
	background: rgba(212, 168, 83, 0.12);
}

.success-card h2 {
	margin-top: 0.35rem;
}

.success-id {
	margin-top: 1rem;
	padding: 0.8rem 1rem;
	border-radius: 12px;
	background: var(--ink-100);
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 0.82rem;
	word-break: break-all;
	color: var(--ink-700);
}

.footer-note {
	margin-top: 1.2rem;
	color: rgba(255, 255, 255, 0.62);
	font-size: 0.84rem;
	text-align: center;
}

.admin-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-bottom: 1rem;
}

.admin-bar input {
	flex: 1;
	min-width: 160px;
}

.table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.88rem;
}

th,
td {
	padding: 0.75rem 0.55rem;
	border-bottom: 1px solid var(--ink-200);
	text-align: left;
	vertical-align: top;
}

th {
	font-size: 0.74rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--ink-500);
}

.error-summary {
	margin: 0 0 1rem;
	padding: 0.9rem 1rem;
	border-radius: var(--radius);
	border: 1px solid rgba(197, 48, 48, 0.35);
	background: rgba(197, 48, 48, 0.12);
	color: #ffd0d0;
}

.error-summary h3 {
	margin: 0 0 0.35rem;
	font-size: 0.95rem;
	color: #fff;
}

.error-summary ul {
	margin: 0;
	padding-left: 1.1rem;
}

@keyframes rise {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes pulse {
	0% {
		box-shadow: 0 0 0 0 rgba(230, 106, 48, 0.55);
	}
	70% {
		box-shadow: 0 0 0 10px rgba(230, 106, 48, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(230, 106, 48, 0);
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation: none !important;
		transition: none !important;
		scroll-behavior: auto !important;
	}
}
