.itrc-calculator,
.itrc-calculator * {
	box-sizing: border-box;
}

.itrc-calculator {
	--itrc-bg: #f4f6f9;
	--itrc-surface: #ffffff;
	--itrc-surface-2: #eef1f5;
	--itrc-text: #151922;
	--itrc-muted: #667085;
	--itrc-border: #d8dee8;
	--itrc-primary: #2f3747;
	--itrc-primary-2: #4c5568;
	--itrc-accent: #7a8498;
	--itrc-danger: #b42318;
	--itrc-success: #067647;
	--itrc-shadow: 0 18px 48px rgba(17, 24, 39, 0.12);
	--itrc-shadow-soft: 0 10px 24px rgba(17, 24, 39, 0.08);
	--itrc-radius-lg: 24px;
	--itrc-radius-md: 16px;
	--itrc-radius-sm: 12px;
	--itrc-focus: 0 0 0 4px rgba(47, 55, 71, 0.18);
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	color: var(--itrc-text);
	max-width: 1220px;
	margin: 0 auto;
	padding: 16px;
}

.itrc-calculator.itrc-dark {
	--itrc-bg: #11151d;
	--itrc-surface: #171c25;
	--itrc-surface-2: #222937;
	--itrc-text: #f7f8fb;
	--itrc-muted: #a9b1c2;
	--itrc-border: #333c4e;
	--itrc-primary: #e5e9f2;
	--itrc-primary-2: #c9d0df;
	--itrc-accent: #8d98ad;
	--itrc-danger: #ffb4ab;
	--itrc-success: #9ee0c0;
	--itrc-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
	--itrc-shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.26);
	--itrc-focus: 0 0 0 4px rgba(229, 233, 242, 0.18);
}

.itrc-shell {
	background:
		radial-gradient(circle at top left, rgba(122, 132, 152, 0.22), transparent 32%),
		linear-gradient(135deg, var(--itrc-bg), var(--itrc-surface-2));
	border: 1px solid var(--itrc-border);
	border-radius: var(--itrc-radius-lg);
	box-shadow: var(--itrc-shadow);
	padding: 16px;
	overflow: hidden;
}

.itrc-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 10px 4px 18px;
}

.itrc-kicker {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--itrc-muted);
}

.itrc-kicker::before {
	content: "";
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--itrc-primary-2);
}

.itrc-title,
.itrc-result-header h3 {
	margin: 6px 0 0;
	font-size: clamp(24px, 4vw, 38px);
	line-height: 1.12;
	letter-spacing: -0.04em;
	color: var(--itrc-text);
}

.itrc-result-header h3 {
	font-size: clamp(20px, 3vw, 28px);
}

.itrc-theme-toggle,
.itrc-btn {
	appearance: none;
	border: 1px solid var(--itrc-border);
	background: var(--itrc-surface);
	color: var(--itrc-text);
	border-radius: 999px;
	padding: 12px 15px;
	font-size: 14px;
	font-weight: 750;
	line-height: 1;
	cursor: pointer;
	box-shadow: var(--itrc-shadow-soft);
	transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.itrc-theme-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	white-space: nowrap;
}

.itrc-theme-toggle:hover,
.itrc-btn:hover {
	transform: translateY(-1px);
	border-color: var(--itrc-primary-2);
}

.itrc-theme-toggle:focus-visible,
.itrc-btn:focus-visible,
.itrc-input:focus-visible,
.itrc-range:focus-visible,
.itrc-segmented input:focus-visible + span,
.itrc-check input:focus-visible + span {
	outline: none;
	box-shadow: var(--itrc-focus);
}

.itrc-layout {
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
}

.itrc-card {
	background: color-mix(in srgb, var(--itrc-surface) 94%, transparent);
	border: 1px solid var(--itrc-border);
	border-radius: var(--itrc-radius-lg);
	box-shadow: var(--itrc-shadow-soft);
	padding: clamp(16px, 3vw, 26px);
}

.itrc-form,
.itrc-mode-panel {
	display: grid;
	gap: 16px;
}

.itrc-mode-fieldset {
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.itrc-mode-fieldset legend,
.itrc-field label,
.itrc-range-head label {
	display: block;
	margin: 0 0 8px;
	font-size: 14px;
	font-weight: 800;
	color: var(--itrc-text);
}

.itrc-segmented {
	display: grid;
	grid-template-columns: 1fr;
	gap: 8px;
	padding: 6px;
	background: var(--itrc-surface-2);
	border: 1px solid var(--itrc-border);
	border-radius: 999px;
}

.itrc-segmented label {
	position: relative;
	cursor: pointer;
}

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

.itrc-segmented span {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 44px;
	border-radius: 999px;
	font-weight: 800;
	color: var(--itrc-muted);
	transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.itrc-segmented input:checked + span {
	background: var(--itrc-surface);
	color: var(--itrc-text);
	box-shadow: 0 8px 18px rgba(17, 24, 39, 0.1);
}

.itrc-field {
	min-width: 0;
}

.itrc-input {
	display: block;
	width: 100%;
	min-height: 48px;
	border: 1px solid var(--itrc-border);
	border-radius: var(--itrc-radius-sm);
	background: var(--itrc-surface);
	color: var(--itrc-text);
	font: inherit;
	font-size: 16px;
	padding: 12px 14px;
	transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.itrc-input::placeholder {
	color: var(--itrc-muted);
}

.itrc-textarea {
	min-height: 180px;
	resize: vertical;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
	line-height: 1.55;
}

.itrc-help {
	margin: 7px 0 0;
	font-size: 13px;
	line-height: 1.45;
	color: var(--itrc-muted);
}

.itrc-grid-2 {
	display: grid;
	grid-template-columns: 1fr;
	gap: 14px;
}

.itrc-range-field {
	padding: 14px;
	border: 1px solid var(--itrc-border);
	border-radius: var(--itrc-radius-md);
	background: var(--itrc-surface-2);
}

.itrc-range-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 10px;
}

.itrc-small-number {
	width: 118px;
	min-height: 42px;
	text-align: center;
}

.itrc-range {
	width: 100%;
	accent-color: var(--itrc-primary-2);
	cursor: pointer;
}

.itrc-options-row {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
}

.itrc-check {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	border: 1px solid var(--itrc-border);
	border-radius: var(--itrc-radius-sm);
	background: var(--itrc-surface);
	cursor: pointer;
	font-size: 14px;
	font-weight: 700;
	color: var(--itrc-text);
}

.itrc-check input {
	width: 18px;
	height: 18px;
	accent-color: var(--itrc-primary-2);
}

.itrc-error {
	padding: 12px 14px;
	border: 1px solid color-mix(in srgb, var(--itrc-danger) 42%, transparent);
	border-radius: var(--itrc-radius-sm);
	background: color-mix(in srgb, var(--itrc-danger) 10%, transparent);
	color: var(--itrc-danger);
	font-weight: 750;
	line-height: 1.45;
}

.itrc-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	padding-top: 4px;
}

.itrc-btn-primary {
	background: var(--itrc-primary);
	border-color: var(--itrc-primary);
	color: var(--itrc-surface);
}

.itrc-result-card {
	display: grid;
	gap: 18px;
}

.itrc-result-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 14px;
}

.itrc-status {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 34px;
	padding: 8px 12px;
	border: 1px solid var(--itrc-border);
	border-radius: 999px;
	background: var(--itrc-surface-2);
	color: var(--itrc-success);
	font-size: 13px;
	font-weight: 850;
	white-space: nowrap;
}

.itrc-result-main {
	padding: clamp(18px, 4vw, 28px);
	border-radius: var(--itrc-radius-lg);
	background: linear-gradient(135deg, var(--itrc-primary), var(--itrc-primary-2));
	color: var(--itrc-surface);
	box-shadow: var(--itrc-shadow-soft);
}

.itrc-big-number {
	font-size: clamp(30px, 8vw, 58px);
	line-height: 1;
	font-weight: 900;
	letter-spacing: -0.06em;
	word-break: break-word;
}

.itrc-summary-text {
	margin: 12px 0 0;
	font-size: 15px;
	line-height: 1.55;
	color: color-mix(in srgb, var(--itrc-surface) 86%, transparent);
}

.itrc-metrics {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
}

.itrc-metric {
	padding: 14px;
	border: 1px solid var(--itrc-border);
	border-radius: var(--itrc-radius-md);
	background: var(--itrc-surface-2);
}

.itrc-metric span {
	display: block;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--itrc-muted);
}

.itrc-metric strong {
	display: block;
	margin-top: 6px;
	font-size: 18px;
	line-height: 1.25;
	color: var(--itrc-text);
	word-break: break-word;
}

.itrc-chart-wrap {
	position: relative;
	width: 100%;
	min-height: 260px;
	padding: 12px;
	border: 1px solid var(--itrc-border);
	border-radius: var(--itrc-radius-lg);
	background: var(--itrc-surface);
	overflow: hidden;
}

.itrc-chart {
	display: block;
	width: 100%;
	height: auto;
	max-height: 420px;
}

.itrc-table-wrap {
	width: 100%;
	max-height: 360px;
	overflow: auto;
	border: 1px solid var(--itrc-border);
	border-radius: var(--itrc-radius-lg);
	background: var(--itrc-surface);
}

.itrc-table {
	width: 100%;
	border-collapse: collapse;
	min-width: 520px;
	font-size: 14px;
}

.itrc-table caption {
	padding: 12px 14px;
	text-align: left;
	font-weight: 850;
	color: var(--itrc-text);
}

.itrc-table th,
.itrc-table td {
	padding: 10px 12px;
	border-top: 1px solid var(--itrc-border);
	text-align: right;
	white-space: nowrap;
}

.itrc-table th:first-child,
.itrc-table td:first-child {
	text-align: left;
}

.itrc-table th {
	position: sticky;
	top: 0;
	z-index: 1;
	background: var(--itrc-surface-2);
	font-weight: 850;
	color: var(--itrc-text);
}

.itrc-hidden,
.itrc-chart-wrap.itrc-hidden,
.itrc-table-wrap.itrc-hidden {
	display: none !important;
}

@media (min-width: 520px) {
	.itrc-segmented,
	.itrc-grid-2,
	.itrc-options-row,
	.itrc-metrics {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 980px) {
	.itrc-calculator {
		padding: 24px;
	}

	.itrc-shell {
		padding: 24px;
	}

	.itrc-layout {
		grid-template-columns: minmax(360px, 0.86fr) minmax(0, 1.14fr);
		align-items: start;
	}

	.itrc-input-card,
	.itrc-result-card {
		position: sticky;
		top: 24px;
	}

	.itrc-result-card {
		position: relative;
		top: auto;
	}

	.itrc-metrics {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.itrc-header,
	.itrc-result-header {
		flex-direction: column;
		align-items: stretch;
	}

	.itrc-theme-toggle,
	.itrc-status {
		width: 100%;
	}

	.itrc-actions .itrc-btn {
		flex: 1 1 100%;
		min-height: 48px;
	}

	.itrc-range-head {
		align-items: flex-start;
		flex-direction: column;
	}

	.itrc-small-number {
		width: 100%;
	}
}

@media print {
	.itrc-calculator {
		padding: 0;
		max-width: none;
	}

	.itrc-shell,
	.itrc-card,
	.itrc-result-main,
	.itrc-table-wrap,
	.itrc-chart-wrap {
		box-shadow: none !important;
	}

	.itrc-input-card,
	.itrc-theme-toggle,
	.itrc-actions {
		display: none !important;
	}

	.itrc-layout {
		display: block;
	}
}
