/* ── Page copy (intro above / body below the calculator, from page content) ── */
/* No max-width on the wrapper itself — only the prose children (p/h2/h3/
   list) are capped to a readable line length. The calculator (.kpr-wrap)
   is a direct child too, but sets its own (much wider) max-width below,
   so it isn't squeezed down to the 900px prose column. */
.kpr-page-content {
	font-size: var(--cires-text-base);
	line-height: 1.8;
	color: var(--cires-neutral-700);
}

.kpr-page-content > p,
.kpr-page-content > h2,
.kpr-page-content > h3,
.kpr-page-content > ul,
.kpr-page-content > ol {
	max-width: 900px;
	margin-left: auto;
	margin-right: auto;
}

.kpr-page-content > p {
	margin-bottom: var(--cires-space-lg);
}

.kpr-page-content > h2 {
	font-size: var(--cires-text-xl);
	font-weight: 700;
	color: var(--cires-color-heading);
	margin-top: var(--cires-space-2xl);
	margin-bottom: var(--cires-space-md);
}

.kpr-page-content > h3 {
	font-size: var(--cires-text-lg);
	font-weight: 700;
	color: var(--cires-color-heading);
	margin-top: var(--cires-space-xl);
	margin-bottom: var(--cires-space-sm);
}

.kpr-page-content > ul,
.kpr-page-content > ol {
	margin-bottom: var(--cires-space-lg);
	padding-left: var(--cires-space-lg);
}

.kpr-page-content > ul li,
.kpr-page-content > ol li {
	margin-bottom: var(--cires-space-xs);
}

/* The calculator shortcode's own max-width wrapper sits inside the content
   flow above — give it room to breathe from the surrounding copy. */
.kpr-page-content .kpr-wrap {
	margin-top: var(--cires-space-2xl);
	margin-bottom: var(--cires-space-2xl);
}

/* ── KPR Calculator: layout ── */
.kpr-wrap {
	max-width: var(--cires-container-wide);
	margin: 0 auto;
}

.kpr-grid {
	display: grid;
	grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
	gap: var(--cires-space-2xl);
	align-items: start;
}

@media (max-width: 61.99875em) {
	.kpr-grid {
		grid-template-columns: 1fr;
	}
}

.kpr-form-card,
.kpr-result-card {
	background: var(--cires-white);
	border-radius: var(--cires-radius-xl);
	box-shadow: var(--cires-shadow-card);
	padding: var(--cires-space-xl);
}

.kpr-form-card__title {
	font-size: var(--cires-text-lg);
	font-weight: 700;
	color: var(--cires-color-heading);
	margin: 0 0 var(--cires-space-lg);
}

/* ── Fields ── */
.kpr-field {
	margin-bottom: var(--cires-space-lg);
}

.kpr-label {
	display: block;
	font-size: var(--cires-text-sm);
	font-weight: 600;
	color: var(--cires-neutral-800);
	margin-bottom: var(--cires-space-xs);
}

.kpr-required {
	color: #d92d20;
}

.kpr-input-affix {
	display: flex;
	align-items: center;
	border: 1px solid var(--cires-neutral-300);
	border-radius: var(--cires-radius-md);
	overflow: hidden;
	background: var(--cires-white);
}

.kpr-input-affix:focus-within {
	border-color: var(--cires-color-primary);
}

.kpr-input-affix--sm {
	max-width: 140px;
}

.kpr-input-affix__prefix,
.kpr-input-affix__suffix {
	padding: 0 var(--cires-space-sm);
	color: var(--cires-neutral-600);
	font-size: var(--cires-text-sm);
	background: var(--cires-neutral-50);
	align-self: stretch;
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.kpr-input {
	flex: 1;
	min-width: 0;
	border: none;
	outline: none;
	padding: var(--cires-space-sm) var(--cires-space-md);
	font-size: var(--cires-text-base);
	color: var(--cires-color-heading);
	background: transparent;
	font-family: var(--cires-font-body);
}

.kpr-input[readonly] {
	color: var(--cires-neutral-600);
}

.kpr-dp-row {
	display: flex;
	gap: var(--cires-space-sm);
	margin-bottom: var(--cires-space-sm);
}

.kpr-dp-row .kpr-input-affix {
	margin-bottom: 0;
}

.kpr-slider {
	width: 100%;
	accent-color: var(--cires-color-primary);
	margin: var(--cires-space-xs) 0;
}

.kpr-slider-labels {
	display: flex;
	justify-content: space-between;
	font-size: var(--cires-text-xs);
	color: var(--cires-neutral-500);
}

/* ── Scheme toggle (Fix / Berjenjang) ── */
.kpr-scheme-toggle {
	display: inline-flex;
	border: 1px solid var(--cires-neutral-300);
	border-radius: var(--cires-radius-md);
	overflow: hidden;
}

.kpr-scheme-toggle__btn {
	border: none;
	background: var(--cires-white);
	color: var(--cires-neutral-700);
	padding: var(--cires-space-xs) var(--cires-space-lg);
	font-size: var(--cires-text-sm);
	font-weight: 600;
	cursor: pointer;
	transition: background var(--cires-transition-fast), color var(--cires-transition-fast);
}

.kpr-scheme-toggle__btn.is-active {
	background: var(--cires-color-primary);
	color: var(--cires-white);
}

.kpr-berjenjang-fields {
	border-left: 3px solid var(--cires-neutral-200);
	padding-left: var(--cires-space-md);
}

.kpr-simulate-btn {
	width: 100%;
	justify-content: center;
}

/* ── Result card ── */
.kpr-tabs {
	display: flex;
	gap: var(--cires-space-xs);
	background: var(--cires-neutral-50);
	border-radius: var(--cires-radius-md);
	padding: var(--cires-space-3xs);
	margin-bottom: var(--cires-space-lg);
}

.kpr-tab {
	flex: 1;
	border: none;
	background: transparent;
	padding: var(--cires-space-sm) var(--cires-space-md);
	font-size: var(--cires-text-sm);
	font-weight: 600;
	color: var(--cires-neutral-600);
	border-radius: var(--cires-radius-sm);
	cursor: pointer;
	transition: background var(--cires-transition-fast), color var(--cires-transition-fast);
}

.kpr-tab.is-active {
	background: var(--cires-white);
	color: var(--cires-color-primary);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.kpr-result-box {
	border: 1px solid var(--cires-neutral-200);
	border-radius: var(--cires-radius-lg);
	padding: var(--cires-space-lg);
	margin-bottom: var(--cires-space-lg);
}

.kpr-result-box__title {
	font-size: var(--cires-text-base);
	font-weight: 700;
	color: var(--cires-color-heading);
	margin: 0 0 var(--cires-space-md);
	padding-bottom: var(--cires-space-sm);
	border-bottom: 1px solid var(--cires-neutral-200);
}

.kpr-angsuran-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: var(--cires-space-sm) 0;
}

.kpr-angsuran-row + .kpr-angsuran-row {
	border-top: 1px solid var(--cires-neutral-100);
}

.kpr-angsuran-row__meta {
	font-size: var(--cires-text-xs);
	color: var(--cires-neutral-600);
}

.kpr-angsuran-row__rate {
	font-size: var(--cires-text-sm);
	font-weight: 600;
	color: var(--cires-neutral-800);
}

.kpr-angsuran-row__amount {
	font-size: var(--cires-text-lg);
	font-weight: 700;
	color: var(--cires-color-primary);
}

.kpr-breakdown-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.kpr-breakdown-list li {
	display: flex;
	justify-content: space-between;
	padding: var(--cires-space-xs) 0;
	font-size: var(--cires-text-sm);
	color: var(--cires-neutral-700);
}

.kpr-breakdown-list li.kpr-breakdown-total {
	font-weight: 700;
	color: var(--cires-color-heading);
	border-bottom: 1px solid var(--cires-neutral-200);
	padding-bottom: var(--cires-space-sm);
	margin-bottom: var(--cires-space-xs);
}

.kpr-breakdown-label-info {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	cursor: help;
}

.kpr-info-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var(--cires-neutral-300);
	color: var(--cires-white);
	font-size: 10px;
	font-style: italic;
	font-weight: 700;
	line-height: 1;
}

.kpr-tooltip {
	display: none;
	position: absolute;
	bottom: calc(100% + 8px);
	left: 0;
	width: min(240px, calc(100vw - 48px));
	background: var(--cires-color-heading);
	color: var(--cires-white);
	font-size: var(--cires-text-xs);
	font-weight: 400;
	line-height: 1.5;
	padding: var(--cires-space-sm) var(--cires-space-md);
	border-radius: var(--cires-radius-md);
	z-index: 2;
	white-space: normal;
}

.kpr-breakdown-label-info:hover .kpr-tooltip,
.kpr-breakdown-label-info:focus .kpr-tooltip,
.kpr-breakdown-label-info:focus-within .kpr-tooltip {
	display: block;
}

.kpr-disclaimer {
	font-size: var(--cires-text-xs);
	color: var(--cires-neutral-500);
	margin: 0;
}

/* ── First-visit lock: blur the Angsuran result until "Simulasikan" runs once ── */
.kpr-angsuran-content {
	position: relative;
}

.kpr-angsuran-content.is-locked .kpr-result-box,
.kpr-angsuran-content.is-locked .kpr-disclaimer {
	filter: blur(6px);
	user-select: none;
	pointer-events: none;
}

.kpr-angsuran-overlay {
	display: none;
	position: absolute;
	inset: 0;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: var(--cires-space-xl);
	z-index: 1;
}

.kpr-angsuran-content.is-locked .kpr-angsuran-overlay {
	display: flex;
}

.kpr-angsuran-overlay__text {
	background: var(--cires-white);
	border: 1px solid var(--cires-neutral-200);
	border-radius: var(--cires-radius-lg);
	box-shadow: var(--cires-shadow-card);
	padding: var(--cires-space-lg);
	max-width: 280px;
	font-size: var(--cires-text-sm);
	font-weight: 600;
	color: var(--cires-color-heading);
	margin: 0;
}

.kpr-empty-state {
	color: var(--cires-neutral-500);
	font-size: var(--cires-text-sm);
	text-align: center;
	padding: var(--cires-space-2xl) 0;
}

/* ── Insight tab ── */
.kpr-insight-locked {
	text-align: center;
	padding: var(--cires-space-2xl) var(--cires-space-lg);
	border: 1px dashed var(--cires-neutral-300);
	border-radius: var(--cires-radius-lg);
}

.kpr-insight-locked__text {
	color: var(--cires-neutral-700);
	font-size: var(--cires-text-sm);
	max-width: 360px;
	margin: 0 auto var(--cires-space-lg);
	line-height: 1.7;
}

.kpr-insight-intro p {
	margin: 0 0 var(--cires-space-xs);
	color: var(--cires-neutral-700);
	font-size: var(--cires-text-sm);
}

.kpr-insight-hint {
	color: var(--cires-neutral-500) !important;
	font-size: var(--cires-text-xs) !important;
}

.kpr-analisa-btn {
	width: 100%;
	justify-content: center;
}

.kpr-insight-result {
	margin-top: var(--cires-space-xl);
}

.kpr-insight-result__narrative {
	background: var(--cires-turquoise-0);
	border-radius: var(--cires-radius-lg);
	padding: var(--cires-space-lg);
	color: var(--cires-neutral-800);
	font-size: var(--cires-text-sm);
	line-height: 1.7;
	margin-bottom: var(--cires-space-lg);
}

.kpr-insight-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--cires-space-md);
	margin-bottom: var(--cires-space-lg);
}

@media (max-width: 35.99875em) {
	.kpr-insight-stats {
		grid-template-columns: 1fr;
	}
}

.kpr-insight-stat {
	border: 1px solid var(--cires-neutral-200);
	border-radius: var(--cires-radius-md);
	padding: var(--cires-space-md);
	text-align: center;
}

.kpr-insight-stat__label {
	font-size: var(--cires-text-xs);
	color: var(--cires-neutral-600);
	display: block;
	margin-bottom: 2px;
}

.kpr-insight-stat__value {
	font-size: var(--cires-text-base);
	font-weight: 700;
	color: var(--cires-color-primary);
}

.kpr-insight-disclaimer {
	font-size: var(--cires-text-xs);
	color: var(--cires-neutral-500);
	line-height: 1.6;
	margin: 0 0 var(--cires-space-xl);
}

.kpr-insight-products__title {
	font-size: var(--cires-text-base);
	font-weight: 700;
	color: var(--cires-color-heading);
	margin: 0 0 var(--cires-space-md);
}

/* ── Insight "take note" assessment cards (is this cicilan a good fit?) ── */
.kpr-check-list {
	display: grid;
	/* min(240px, 100%) instead of a bare 240px: a hard 240px floor is wider
	   than the available content box on narrow phones (~320-359px, after
	   container gutter + card padding), which forces a horizontal
	   scrollbar. Capping the track at 100% lets it shrink to fit instead. */
	grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
	gap: var(--cires-space-md);
	margin-bottom: var(--cires-space-xl);
}

.kpr-check-card {
	display: flex;
	align-items: flex-start;
	gap: var(--cires-space-sm);
	border: 1px solid var(--cires-neutral-200);
	border-left: 4px solid var(--cires-neutral-300);
	border-radius: var(--cires-radius-md);
	padding: var(--cires-space-md);
	background: var(--cires-white);
}

.kpr-check-card--good {
	border-left-color: #16a34a;
	background: #f0fdf4;
}

.kpr-check-card--warning {
	border-left-color: #d97706;
	background: #fffbeb;
}

.kpr-check-card--bad {
	border-left-color: #d92d20;
	background: #fef2f2;
}

.kpr-check-card__icon {
	flex-shrink: 0;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 700;
	color: var(--cires-white);
}

.kpr-check-card--good .kpr-check-card__icon {
	background: #16a34a;
}

.kpr-check-card--warning .kpr-check-card__icon {
	background: #d97706;
}

.kpr-check-card--bad .kpr-check-card__icon {
	background: #d92d20;
}

.kpr-check-card__title {
	font-size: var(--cires-text-sm);
	font-weight: 700;
	color: var(--cires-color-heading);
	margin: 0 0 2px;
}

.kpr-check-card__desc {
	font-size: var(--cires-text-xs);
	color: var(--cires-neutral-700);
	line-height: 1.6;
	margin: 0;
}

.kpr-product-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr));
	gap: var(--cires-space-md);
}

.kpr-product-card {
	display: block;
	border: 1px solid var(--cires-neutral-200);
	border-radius: var(--cires-radius-md);
	overflow: hidden;
	text-decoration: none;
	transition: box-shadow var(--cires-transition-fast);
}

.kpr-product-card:hover {
	box-shadow: var(--cires-shadow-card);
}

.kpr-product-card__image {
	width: 100%;
	aspect-ratio: 4 / 3;
	background: var(--cires-neutral-200);
	object-fit: cover;
	display: block;
}

.kpr-product-card__body {
	padding: var(--cires-space-sm) var(--cires-space-md);
}

.kpr-product-card__title {
	font-size: var(--cires-text-sm);
	font-weight: 700;
	color: var(--cires-color-heading);
	margin: 0 0 2px;
}

.kpr-product-card__project {
	font-size: var(--cires-text-xs);
	color: var(--cires-neutral-600);
	margin: 0 0 4px;
}

.kpr-product-card__price {
	font-size: var(--cires-text-sm);
	font-weight: 700;
	color: var(--cires-color-primary);
}

/* ── Insight lead modal ── */
.kpr-modal {
	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--cires-space-lg);
	opacity: 0;
	visibility: hidden;
	transition: opacity var(--cires-transition-fast), visibility var(--cires-transition-fast);
}

.kpr-modal.is-open {
	opacity: 1;
	visibility: visible;
}

.kpr-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
}

.kpr-modal__dialog {
	position: relative;
	background: var(--cires-white);
	border-radius: var(--cires-radius-xl);
	padding: var(--cires-space-xl);
	max-width: 420px;
	width: 100%;
	max-height: 90vh;
	overflow-y: auto;
}

.kpr-modal__close {
	position: absolute;
	top: var(--cires-space-md);
	right: var(--cires-space-md);
	border: none;
	background: none;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	color: var(--cires-neutral-500);
}

.kpr-modal__dialog h3 {
	margin: 0 0 var(--cires-space-xs);
	font-size: var(--cires-text-lg);
	color: var(--cires-color-heading);
	padding-right: var(--cires-space-xl);
}

.kpr-modal__desc {
	font-size: var(--cires-text-sm);
	color: var(--cires-neutral-600);
	margin: 0 0 var(--cires-space-lg);
}

.kpr-modal__error {
	color: #d92d20;
	font-size: var(--cires-text-sm);
	margin: 0 0 var(--cires-space-md);
}

/* ── Loading bar shown right after "Lihat Hasil Analisa" is submitted ── */
.kpr-loading-bar {
	margin: 0 0 var(--cires-space-md);
}

.kpr-loading-bar__fill {
	position: relative;
	height: 4px;
	border-radius: var(--cires-radius-full);
	background: var(--cires-neutral-200);
	overflow: hidden;
}

.kpr-loading-bar__fill::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: 40%;
	border-radius: var(--cires-radius-full);
	background: var(--cires-color-primary);
	animation: kpr-loading-slide 1.1s ease-in-out infinite;
}

@keyframes kpr-loading-slide {
	0% { transform: translateX(-100%); }
	100% { transform: translateX(350%); }
}

.kpr-loading-bar__label {
	display: block;
	margin-top: var(--cires-space-xs);
	font-size: var(--cires-text-xs);
	color: var(--cires-neutral-600);
	text-align: center;
}

.kpr-modal__actions .btn {
	width: 100%;
	justify-content: center;
}

.kpr-modal__actions .btn[disabled] {
	opacity: 0.6;
	cursor: not-allowed;
}

/* ── Mobile: keep the whole calculator inside 100% width, no horizontal overflow ── */
@media (max-width: 35.99875em) {
	/* "Isi Rencana KPR" input form loses its card chrome entirely on mobile —
	   no padding, no shadow, no boxed background — so it reads as a plain
	   section of the page rather than a floating card. The RESULT side
	   (.kpr-result-card — Angsuran output and the AI Insight panel) keeps
	   its card look; only the input form is flattened. */
	.kpr-form-card,
	.kpr-result-card {
		padding: 0;
		box-shadow: none;
		background: transparent;
		border-radius: 0;
	}

	.kpr-modal__dialog {
		padding: var(--cires-space-lg);
	}

	/* The DP % field's 140px cap leaves very little room for the Rp amount
	   field beside it once the card itself has shrunk to phone width —
	   stack them instead of squeezing both onto one row. */
	.kpr-dp-row {
		flex-direction: column;
	}

	.kpr-dp-row .kpr-input-affix--sm {
		max-width: none;
	}

	.kpr-scheme-toggle {
		display: flex;
	}

	.kpr-scheme-toggle__btn {
		flex: 1;
		padding-left: var(--cires-space-sm);
		padding-right: var(--cires-space-sm);
	}

	/* Nested item cards (Insight stats / check notes / product picks) drop
	   their own border+radius+shadow chrome on mobile and become plain
	   divider-separated rows instead — a stack of individually-boxed cards
	   reads as cluttered once everything is single-column anyway. The three
	   main containers (.kpr-form-card, .kpr-result-card, and everything
	   inside them — Angsuran result, AI Insight panel) are untouched: this
	   only targets the small repeated items inside those containers. */
	.kpr-insight-stats {
		display: block;
	}

	.kpr-insight-stat {
		display: flex;
		align-items: center;
		justify-content: space-between;
		text-align: left;
		border: none;
		border-radius: 0;
		border-bottom: 1px solid var(--cires-neutral-200);
		padding: var(--cires-space-sm) 0;
	}

	.kpr-insight-stat:last-child {
		border-bottom: none;
	}

	.kpr-check-list {
		display: block;
	}

	.kpr-check-card {
		border: none;
		border-left: 4px solid var(--cires-neutral-300);
		border-radius: 0;
		border-bottom: 1px solid var(--cires-neutral-200);
		background: transparent;
		padding: var(--cires-space-md) var(--cires-space-sm);
	}

	.kpr-check-card--good {
		border-left-color: #16a34a;
		background: transparent;
	}

	.kpr-check-card--warning {
		border-left-color: #d97706;
		background: transparent;
	}

	.kpr-check-card--bad {
		border-left-color: #d92d20;
		background: transparent;
	}

	.kpr-check-card:last-child {
		border-bottom: none;
	}

	.kpr-product-list {
		display: block;
	}

	.kpr-product-card {
		display: flex;
		align-items: center;
		gap: var(--cires-space-md);
		border: none;
		border-radius: 0;
		border-bottom: 1px solid var(--cires-neutral-200);
	}

	.kpr-product-card:hover {
		box-shadow: none;
	}

	.kpr-product-card:last-child {
		border-bottom: none;
	}

	.kpr-product-card__image {
		width: 72px;
		height: 72px;
		aspect-ratio: auto;
		flex-shrink: 0;
		border-radius: var(--cires-radius-sm);
	}

	.kpr-product-card__body {
		padding: var(--cires-space-sm) 0;
	}
}
