/* China-Cars калькуляторы. Цвета можно переопределить в теме через переменные --cc-*. */
.cc-calc,
.cc-rates-tables,
.cc-example,
.cc-rates-info {
	--cc-accent: #c62828;
	--cc-accent-soft: #fdecea;
	--cc-text: inherit;
	--cc-muted: #5f6b7a;
	--cc-border: #dfe3e8;
	--cc-bg: #ffffff;
	--cc-bg-soft: #f6f7f9;
	--cc-good: #1b7f3b;
	--cc-radius: 12px;
	box-sizing: border-box;
	color: var(--cc-text);
}
.cc-calc *,
.cc-rates-tables *,
.cc-example * { box-sizing: border-box; }

.cc-calc {
	background: var(--cc-bg);
	border: 1px solid var(--cc-border);
	border-radius: var(--cc-radius);
	padding: 20px;
	margin: 0 0 32px;
}

/* ---------- Форма ---------- */
.cc-form {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px 20px;
	margin: 0;
}
.cc-field { margin: 0; padding: 0; border: 0; min-width: 0; }
.cc-field--wide,
.cc-rates { grid-column: 1 / -1; }
.cc-field[hidden] { display: none; }
.cc-field > label,
.cc-field legend,
.cc-field--pair label {
	display: block;
	font-weight: 600;
	font-size: 0.95em;
	margin: 0 0 6px;
	padding: 0;
}
.cc-field--pair {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}
.cc-calc input[type="text"],
.cc-calc input[type="number"],
.cc-calc select {
	width: 100%;
	min-height: 44px;
	padding: 8px 12px;
	border: 1px solid var(--cc-border);
	border-radius: 8px;
	background: #fff;
	font: inherit;
	color: inherit;
	margin: 0;
}
.cc-calc input:focus,
.cc-calc select:focus {
	outline: 2px solid var(--cc-accent);
	outline-offset: 1px;
	border-color: var(--cc-accent);
}
.cc-money { display: flex; gap: 8px; }
.cc-money input { flex: 1 1 auto; min-width: 0; }
.cc-money select { flex: 0 0 110px; width: 110px; }
.cc-hint { display: block; color: var(--cc-muted); font-size: 0.85em; margin-top: 4px; line-height: 1.35; }

.cc-seg { display: inline-flex; border: 1px solid var(--cc-border); border-radius: 10px; overflow: hidden; flex-wrap: wrap; }
.cc-seg label { position: relative; margin: 0; cursor: pointer; }
.cc-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cc-seg span { display: block; padding: 10px 18px; min-height: 44px; line-height: 24px; }
.cc-seg input:checked + span { background: var(--cc-accent); color: #fff; }
.cc-seg input:focus-visible + span { outline: 2px solid var(--cc-accent); outline-offset: -4px; }
.cc-check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400 !important; cursor: pointer; }
.cc-check input { margin-top: 4px; }

.cc-rates { font-size: 0.85em; color: var(--cc-muted); }
.cc-rates__line { margin: 0; }
.cc-rates__edit { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 8px; }
.cc-rates__edit[hidden] { display: none; }
.cc-rates__edit input { width: 110px !important; min-height: 36px !important; display: inline-block; }
.cc-link { background: none; border: 0; padding: 0; color: var(--cc-accent); text-decoration: underline; cursor: pointer; font: inherit; }

/* ---------- Результат ---------- */
.cc-result { margin-top: 24px; min-height: 220px; }
.cc-summary {
	background: var(--cc-accent-soft);
	border-radius: var(--cc-radius);
	padding: 16px 20px;
	margin-bottom: 16px;
}
.cc-summary p { margin: 0; }
.cc-summary__label { font-weight: 600; }
.cc-summary__total { font-size: 2em; font-weight: 700; line-height: 1.2; margin: 4px 0 !important; }
.cc-summary__meta { color: var(--cc-muted); font-size: 0.9em; }
.cc-summary__best { margin-top: 8px !important; }

.cc-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.cc-option { border: 1px solid var(--cc-border); border-radius: var(--cc-radius); padding: 16px; }
.cc-option.is-best { border-color: var(--cc-good); box-shadow: 0 0 0 1px var(--cc-good) inset; }
.cc-option__title { font-size: 1.05em; margin: 0 0 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cc-badge { background: var(--cc-good); color: #fff; font-size: 0.75em; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.cc-option__note { font-size: 0.85em; color: var(--cc-muted); margin: 10px 0 0; line-height: 1.4; }

.cc-table { width: 100%; border-collapse: collapse; margin: 0; font-size: 0.95em; }
.cc-table th,
.cc-table td { padding: 7px 0; border: 0; border-bottom: 1px solid var(--cc-border); text-align: left; vertical-align: top; font-weight: 400; background: none; }
.cc-table td { text-align: right; padding-left: 12px; white-space: nowrap; width: 1%; }
.cc-row--info th,
.cc-row--info td { color: var(--cc-muted); }
.cc-row__note { display: block; color: var(--cc-muted); font-size: 0.85em; }
.cc-row--total th,
.cc-row--total td { font-weight: 700; border-bottom: 0; padding-top: 10px; }
.cc-row--car th,
.cc-row--car td { color: var(--cc-muted); border-bottom: 0; font-size: 0.9em; }
.cc-num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cc-table td.cc-td-text { white-space: normal; width: 60%; }
.cc-table--ranges td { white-space: normal; width: 42%; }
.cc-table td .cc-row__note { display: block; }

.cc-formula { margin-top: 10px; font-size: 0.85em; }
.cc-formula summary { cursor: pointer; color: var(--cc-accent); }
.cc-formula ul { margin: 8px 0 0; padding-left: 18px; }
.cc-formula li { margin: 4px 0; }

.cc-alert { background: var(--cc-bg-soft); border-left: 4px solid var(--cc-accent); padding: 12px 16px; border-radius: 8px; margin: 0; }
.cc-alert--error { border-left-color: #b32d2e; }
.cc-result__excluded { font-size: 0.85em; color: var(--cc-muted); margin: 12px 0 0; }

/* ---------- Кнопки ---------- */
.cc-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 20px; }
.cc-btn {
	display: inline-flex; align-items: center; justify-content: center;
	min-height: 44px; padding: 10px 16px;
	border: 1px solid var(--cc-border); border-radius: 10px;
	background: #fff; color: inherit; font: inherit; font-weight: 600;
	text-decoration: none; cursor: pointer;
}
.cc-btn:hover { border-color: var(--cc-accent); }
.cc-btn--primary { background: #25d366; border-color: #25d366; color: #0b2b16; }
.cc-btn--primary:hover { background: #1fbd5a; border-color: #1fbd5a; color: #0b2b16; }
.cc-toast { color: var(--cc-good); font-size: 0.9em; }
.cc-author,
.cc-disclaimer { font-size: 0.85em; color: var(--cc-muted); margin: 12px 0 0; }

/* ---------- Таблицы ставок и примеры ---------- */
.cc-rates-tables h3 { margin: 24px 0 8px; }
.cc-table--rates th,
.cc-table--rates td { text-align: left; padding: 8px 10px; border: 1px solid var(--cc-border); white-space: normal; width: auto; }
.cc-table--rates thead th { background: var(--cc-bg-soft); font-weight: 600; }
.cc-table--rates { margin-bottom: 8px; }
.cc-rates-tables { max-width: 100%; overflow-x: auto; }
.cc-table-note { font-size: 0.85em; color: var(--cc-muted); margin: 4px 0 16px; }
.cc-example { border: 1px solid var(--cc-border); border-radius: var(--cc-radius); padding: 16px; margin: 0 0 24px; }
.cc-example__title { font-weight: 600; margin: 0 0 12px; }
.cc-rates-info { font-size: 0.9em; color: var(--cc-muted); }

/* ---------- Автокредит ---------- */
.cc-more { grid-column: 1 / -1; border: 1px solid var(--cc-border); border-radius: 10px; padding: 0 14px; }
.cc-more > summary { cursor: pointer; font-weight: 600; padding: 12px 0; color: var(--cc-accent); }
.cc-more[open] > summary { border-bottom: 1px solid var(--cc-border); margin-bottom: 14px; }
.cc-more__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; padding-bottom: 14px; }
.cc-check--small { font-size: 0.85em; margin-top: 8px; }
.cc-row--strong th,
.cc-row--strong td { font-weight: 700; }
.cc-table--sub { margin-top: 12px; }
.cc-option__note--accent { color: inherit; background: var(--cc-bg-soft); border-radius: 8px; padding: 10px 12px; }
.cc-schedule { margin-top: 16px; border: 1px solid var(--cc-border); border-radius: var(--cc-radius); padding: 0 16px; }
.cc-schedule > summary { cursor: pointer; font-weight: 600; padding: 14px 0; color: var(--cc-accent); }
.cc-schedule[open] { padding-bottom: 16px; }
.cc-schedule__wrap { max-height: 480px; overflow: auto; -webkit-overflow-scrolling: touch; margin-bottom: 12px; }
.cc-table--schedule { font-size: 0.85em; }
.cc-table--schedule th,
.cc-table--schedule td { text-align: right; padding: 6px 8px; width: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cc-table--schedule th:first-child,
.cc-table--schedule td:first-child { text-align: left; padding-left: 0; color: var(--cc-muted); }
.cc-table--schedule thead th { position: sticky; top: 0; background: var(--cc-bg); font-weight: 600; white-space: normal; vertical-align: bottom; }
.cc-btn--small { min-height: 38px; padding: 6px 12px; font-size: 0.9em; }
.cc-result__next { margin: 12px 0 0; font-weight: 600; }
.cc-result__next a { color: var(--cc-accent); }

@media (max-width: 640px) {
	.cc-calc { padding: 14px; border-radius: 10px; }
	.cc-form { grid-template-columns: 1fr; }
	.cc-more__grid { grid-template-columns: 1fr; }
	.cc-schedule { padding: 0; border: 0; border-top: 1px solid var(--cc-border); border-radius: 0; }
	.cc-table--schedule { font-size: 0.72em; }
	.cc-table--schedule th,
	.cc-table--schedule td { padding: 6px 2px; }
	.cc-summary__total { font-size: 1.6em; }
	.cc-seg { display: flex; }
	.cc-seg label { flex: 1 1 0; text-align: center; }
	.cc-seg span { padding: 10px 8px; }
	.cc-btn { flex: 1 1 100%; }
	.cc-table--rates { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
	.cc-table--rates th,
	.cc-table--rates td { min-width: 130px; }
}

@media print {
	.cc-form, .cc-actions, .cc-formula summary, .cc-schedule .cc-btn { display: none !important; }
	.cc-schedule__wrap { max-height: none; overflow: visible; }
	.cc-calc { border: 0; padding: 0; }
	.cc-formula ul { display: block; }
}
