/*
 * cost_allocation_demo.css
 * 工事原価管理とは｜共通費(間接費)を配賦する体験デモ
 * 配賦基準（直接原価比率／労務時間比率／均等配分）を選ぶと、
 * 現場ごとの粗利率がどう変わるかを再現する。
 * 既存サイトのクラスと衝突しないよう cad- を接頭辞にしています。
 */

#cad-demo {
	box-sizing: border-box;
	margin: 1.4rem 0;
	padding: 1rem 1.1rem 2.2rem;
	background: #fbf3ea;
	border-radius: 1rem;
	scroll-margin-top: 90px;
}

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

.cad-container {
	max-width: 780px;
	margin: 0 auto;
}

.cad-head {
	text-align: center;
	padding-top: 1.6rem;
	margin-bottom: 1.4rem;
}

.cad-badge {
	display: inline-block;
	padding: .6rem 1.6rem;
	border-radius: 999px;
	background: #c2740f;
	color: #fff;
	font-size: .92rem;
	font-weight: 700;
	letter-spacing: .02em;
	margin-bottom: .6rem;
}

h3.cad-headline {
	display: block;
	background: none;
	margin: .7rem auto 0;
	max-width: 38rem;
	font-size: 1.15rem;
	font-weight: 800;
	line-height: 1.65;
	color: #12233f;
}

.cad-headline__mark {
	color: #c2740f;
}

.cad-lead {
	font-size: .82rem;
	color: #555;
	line-height: 1.85;
	margin: .6rem auto 0;
	max-width: 38rem;
}

.cad-panel {
	background: #fff;
	border-radius: 1rem;
	box-shadow: 0 .6rem 1.8rem rgba(0, 30, 70, .08);
	padding: 1.5rem 1.3rem 1.4rem;
}

.cad-common-cost {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .6rem;
	padding: .8rem 1rem;
	margin-bottom: 1.1rem;
	background: #fff8ee;
	border: .1rem solid #f0d6a0;
	border-radius: .8rem;
	text-align: center;
}

.cad-common-cost__label {
	font-size: .78rem;
	font-weight: 700;
	color: #92650a;
}

.cad-common-cost__value {
	font-size: 1.1rem;
	font-weight: 800;
	color: #12233f;
}

.cad-sites {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: .6rem;
	margin-bottom: 1.1rem;
}

.cad-site-card {
	padding: .8rem .7rem;
	border: .1rem solid #ecdfc7;
	border-radius: .8rem;
	background: #fffaf2;
}

.cad-site-card__name {
	display: block;
	margin-bottom: .5rem;
	font-size: .85rem;
	font-weight: 800;
	color: #12233f;
	text-align: center;
}

.cad-site-card__list {
	margin: 0;
}

.cad-site-card__list > div {
	display: flex;
	justify-content: space-between;
	gap: .3rem;
	margin-bottom: .3rem;
	font-size: .7rem;
}

.cad-site-card__list > div:last-child {
	margin-bottom: 0;
}

.cad-site-card__list dt {
	color: #889;
	font-weight: 600;
}

.cad-site-card__list dd {
	margin: 0;
	color: #12233f;
	font-weight: 700;
	white-space: nowrap;
}

.cad-basis {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: .5rem;
	margin-bottom: 1.1rem;
}

.cad-basis-btn {
	appearance: none;
	cursor: pointer;
	border: .1rem solid #ecdfc7;
	background: #fff;
	color: #445;
	padding: .55rem .4rem;
	border-radius: .7rem;
	font-size: .78rem;
	font-weight: 700;
	text-align: center;
}

.cad-basis-btn.is-active {
	background: #c2740f;
	border-color: #c2740f;
	color: #fff;
}

.cad-run-btn {
	appearance: none;
	cursor: pointer;
	border: none;
	width: 100%;
	padding: .8rem .6rem;
	border-radius: .7rem;
	font-size: .9rem;
	font-weight: 800;
	color: #fff;
	background: #12233f;
	margin-bottom: 1.1rem;
}

.cad-result[hidden] {
	display: none !important;
}

.cad-result {
	margin-bottom: 1.1rem;
	animation: cad-result-in .3s ease;
}

@keyframes cad-result-in {
	from { opacity: 0; transform: translateY(.3rem); }
	to { opacity: 1; transform: translateY(0); }
}

.cad-result-table-wrap {
	overflow-x: auto;
	margin-bottom: .8rem;
}

.cad-result-table {
	width: 100%;
	border-collapse: collapse;
	font-size: .8rem;
}

.cad-result-table th,
.cad-result-table td {
	padding: .5rem .6rem;
	border-bottom: .06rem solid #eee;
	text-align: right;
	white-space: nowrap;
}

.cad-result-table th:first-child,
.cad-result-table td:first-child {
	text-align: left;
	font-weight: 700;
}

.cad-result-table th {
	background: #f8f5ef;
	color: #445;
	font-weight: 700;
}

.cad-result-table tr.is-best td {
	background: #f2fbf4;
}

.cad-result-table tr.is-worst td {
	background: #fdf2f2;
}

.cad-result-table .cad-margin-rate {
	font-weight: 800;
}

.cad-result-comment {
	margin: 0;
	padding: .7rem .9rem;
	border-radius: .7rem;
	background: #f2fbf4;
	border: .08rem solid #bfe8cd;
	color: #0d7a33;
	font-size: .78rem;
	font-weight: 700;
	line-height: 1.7;
}

.cad-code-wrap {
	background: #12233f;
	border-radius: .8rem;
	padding: .8rem .9rem .9rem;
	margin-bottom: 1.1rem;
}

.cad-code-label {
	font-size: .64rem;
	font-weight: 700;
	color: #9aa8c9;
	letter-spacing: .03em;
	margin-bottom: .4rem;
}

.cad-code {
	margin: 0;
	font-family: 'Courier New', monospace;
	font-size: .74rem;
	line-height: 1.7;
	color: #d6e0ff;
	white-space: pre-wrap;
	word-break: break-word;
}

.cad-reset-btn {
	appearance: none;
	border: none;
	cursor: pointer;
	display: block;
	margin: 0 auto;
	padding: .5rem 1.2rem;
	border-radius: 999px;
	background: #eef2f5;
	color: #667;
	font-size: .78rem;
	font-weight: 700;
}

.cad-reset-btn:hover {
	background: #e2e8ed;
}

@media screen and (max-width: 640px) {
	#cad-demo { padding: 1rem .8rem 1.8rem; border-radius: .7rem; }
	.cad-panel { padding: 1.1rem .9rem 1rem; border-radius: .7rem; }
	.cad-sites { grid-template-columns: 1fr; }
	.cad-basis { grid-template-columns: 1fr; }
	.cad-badge { font-size: .8rem; padding: .5rem 1.1rem; }
	h3.cad-headline { font-size: 1.05rem; }
}
