/* =========================================================
   CREDIT CALCULATOR
   Specific styles only for calculators/credit.tpl
   ========================================================= */

.credit-calculator,
.credit-calculator *,
.credit-calculator *::before,
.credit-calculator *::after {
	box-sizing: border-box;
}

.credit-calculator {
	width: 100%;
	max-width: 1080px;
	margin: 0 auto;
	overflow: hidden;
}

.credit-layout {
	display: grid;
	grid-template-columns: minmax(0, 600px) minmax(320px, 400px);
	gap: 24px;
	align-items: start;
	justify-content: center;
}

.credit-layout > * {
	min-width: 0;
}

.credit-card {
	width: 100%;
	min-width: 0;
	max-width: 100%;
	padding: 22px;
	border: 1px solid #e1e5ee;
	border-radius: 18px;
	background: #ffffff;
	box-shadow: 0 12px 34px rgba(0, 0, 0, 0.05);
}

.credit-card-title {
	margin: 0 0 18px;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.35;
	color: #111827;
	text-transform: none;
}

.credit-card .form-group {
	max-width: 420px;
	margin-bottom: 16px;
}

.credit-card label {
	display: block;
	margin-bottom: 6px;
	font-weight: 700;
	color: #404549;
}

.credit-card input,
.credit-card select {
	width: 100%;
	max-width: 100%;
	height: 44px;
	box-sizing: border-box;
	border-radius: 8px;
}

.credit-inline-fields {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 150px;
	gap: 10px;
	max-width: 420px;
}

.credit-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	max-width: 420px;
	margin-top: 20px;
}

.credit-error {
	min-height: 20px;
	margin-top: 14px;
	color: #dc2626;
	font-size: 14px;
	font-weight: 600;
}


/* =========================================================
   RESULT CARD
   ========================================================= */

.credit-result-card {
	position: static;
	align-self: start;
}

.credit-result-main {
	margin-bottom: 16px;
	padding: 14px;
	border-radius: 12px;
	background: #f8fafc;
	color: #111827;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.35;
}

.credit-result-list {
	display: grid;
	gap: 10px;
}

.credit-result-row {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 0;
	border-bottom: 1px solid #eef1f5;
}

.credit-result-row span {
	color: #6b7280;
}

.credit-result-row strong {
	color: #111827;
	font-weight: 800;
	text-align: right;
}

.credit-result-row-accent strong {
	color: #dc2626;
}

.credit-formula {
	margin-top: 16px;
	padding: 12px;
	border-radius: 10px;
	background: #f8fafc;
	color: #4b5563;
	font-size: 14px;
	line-height: 1.5;
}


/* =========================================================
   PAYMENT SCHEDULE
   ========================================================= */

.credit-schedule-card {
	grid-column: 1 / -1;
}

.credit-schedule-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 14px;
}

.credit-schedule-summary {
	color: #6b7280;
	font-size: 14px;
	text-align: right;
}

.credit-table-wrap {
	display: block;
	width: 100%;
	max-width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.credit-table {
	width: 100%;
	min-width: 760px;
	border-collapse: collapse;
	font-size: 14px;
}

.credit-table th,
.credit-table td {
	padding: 10px 12px;
	border: 1px solid #eef1f5;
	text-align: right;
	white-space: nowrap;
}

.credit-table th {
	background: #f8fafc;
	color: #111827;
	font-weight: 700;
}

.credit-table th:first-child,
.credit-table td:first-child {
	text-align: center;
}

.credit-table th:nth-child(2),
.credit-table td:nth-child(2) {
	text-align: left;
}

.credit-empty-row {
	text-align: center !important;
	color: #6b7280;
}

.credit-disclaimer {
	margin-top: 12px;
	color: #6b7280;
	font-size: 13px;
	line-height: 1.5;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media only screen and (max-width: 991px) {
	.credit-calculator {
		max-width: 720px;
	}

	.credit-layout {
		grid-template-columns: minmax(0, 1fr);
		gap: 18px;
	}

	.credit-result-card {
		position: static;
	}

	.credit-schedule-card {
		grid-column: auto;
	}

	.credit-card .form-group,
	.credit-inline-fields,
	.credit-actions {
		max-width: 100%;
	}
}

@media only screen and (max-width: 767px) {
	.credit-card {
		padding: 18px;
	}

	.credit-schedule-header {
		display: block;
	}

	.credit-schedule-summary {
		display: block;
		margin-top: 4px;
		text-align: left;
	}

	.credit-table {
		min-width: 680px;
		font-size: 13px;
	}

	.credit-table th,
	.credit-table td {
		padding: 8px 10px;
	}
}

@media only screen and (max-width: 575px) {
	.credit-card {
		padding: 15px;
		border-radius: 12px;
	}

	.credit-card-title {
		margin-bottom: 14px;
		font-size: 16px;
	}

	.credit-result-main {
		padding: 12px;
		font-size: 16px;
		word-break: break-word;
	}

	.credit-result-row {
		flex-direction: column;
		align-items: flex-start;
		gap: 3px;
		padding: 10px 0;
	}

	.credit-result-row strong {
		text-align: left;
		word-break: break-word;
	}

	.credit-inline-fields {
		grid-template-columns: 1fr;
	}

	.credit-actions {
		flex-direction: column;
	}

	.credit-actions .btn {
		width: 100%;
	}

	.credit-formula {
		font-size: 13px;
	}

	.credit-disclaimer {
		font-size: 12px;
	}

	/*
	  На телефоне график превращается в карточки.
	  Так таблица не ломает ширину страницы.
	*/
	.credit-table-wrap {
		overflow-x: visible;
	}

	.credit-table {
		width: 100% !important;
		min-width: 0 !important;
		border-collapse: separate;
		border-spacing: 0 10px;
		font-size: 13px;
	}

	.credit-table thead {
		display: none;
	}

	.credit-table,
	.credit-table tbody,
	.credit-table tr,
	.credit-table td {
		display: block;
		width: 100%;
	}

	.credit-table tr {
		padding: 10px 12px;
		border: 1px solid #eef1f5;
		border-radius: 12px;
		background: #ffffff;
	}

	.credit-table td {
		display: flex;
		justify-content: space-between;
		gap: 12px;
		padding: 7px 0 !important;
		border: 0 !important;
		text-align: right !important;
		white-space: normal !important;
	}

	.credit-table td::before {
		flex: 0 0 auto;
		color: #6b7280;
		font-weight: 600;
		text-align: left;
	}

	.credit-table td:nth-child(1)::before {
		content: "№";
	}

	.credit-table td:nth-child(2)::before {
		content: "Дата платежа";
	}

	.credit-table td:nth-child(3)::before {
		content: "Платёж";
	}

	.credit-table td:nth-child(4)::before {
		content: "Основной долг";
	}

	.credit-table td:nth-child(5)::before {
		content: "Проценты";
	}

	.credit-table td:nth-child(6)::before {
		content: "Остаток долга";
	}

	.credit-empty-row {
		display: block !important;
		padding: 14px 0 !important;
		text-align: center !important;
	}

	.credit-empty-row::before {
		content: "" !important;
	}
}

@media only screen and (max-width: 420px) {
	.credit-card {
		padding: 13px;
	}

	.credit-table tr {
		padding: 9px 10px;
	}

	.credit-table td {
		font-size: 12px;
	}

	.credit-table td::before {
		max-width: 45%;
	}
}