/* ==========================================================================
   小野勝商店 見積もりシステム - フロント表示用スタイル
   配色やフォントは御社サイトのテーマに合わせて調整してください。
   ========================================================================== */

.okp-card {
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	padding: 1.5rem;
	max-width: 640px;
	margin: 0 auto;
	font-size: 15px;
	line-height: 1.6;
	color: #222;
	box-sizing: border-box;
}

/* 見積書ビュー・見積依頼フォームはどちらも広く表示する(約2倍) */
.okp-quote-view,
.okp-quote-form {
	max-width: 1100px;
}

.okp-section-title {
	font-weight: 600;
	font-size: 15px;
	margin: 1.25rem 0 0.75rem;
}

.okp-grid-2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

@media (max-width: 480px) {
	.okp-grid-2 { grid-template-columns: 1fr; }
}

.okp-field { margin-bottom: 4px; }
.okp-field label {
	display: block;
	font-size: 13px;
	color: #666;
	margin-bottom: 4px;
}
.okp-field input,
.okp-field textarea,
.okp-quote-form select,
.okp-quote-form input {
	width: 100%;
	box-sizing: border-box;
	padding: 8px 10px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 14px;
}
.okp-required { color: #c0392b; font-size: 11px; }

.okp-item-row {
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	padding: 12px;
	margin-bottom: 10px;
	position: relative;
}
.okp-item-row .okp-item-row-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 8px;
	font-size: 12px;
	color: #888;
}
.okp-item-row .okp-remove-item {
	background: none;
	border: none;
	color: #c0392b;
	cursor: pointer;
	font-size: 13px;
}
.okp-item-row .okp-row-fields {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}
.okp-item-row .okp-row-fields-3 {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 8px;
	margin-top: 8px;
}
.okp-thread-note {
	font-size: 12px;
	color: #888;
	margin: 4px 0 0;
}

.okp-btn-primary,
.okp-btn-secondary {
	display: inline-block;
	padding: 10px 18px;
	border-radius: 6px;
	font-size: 14px;
	cursor: pointer;
	border: 1px solid transparent;
	text-decoration: none;
	text-align: center;
}
.okp-btn-primary {
	background: #2e5c8a;
	color: #fff;
	width: 100%;
	margin-top: 12px;
}
.okp-btn-primary[disabled] {
	background: #aaa;
	cursor: not-allowed;
}
.okp-btn-secondary {
	background: #f5f5f5;
	color: #333;
	border-color: #ccc;
	width: 100%;
	margin-bottom: 10px;
}

.okp-message {
	margin: 10px 0;
	padding: 10px;
	border-radius: 4px;
	font-size: 13px;
}
.okp-message.okp-error { background: #fdecea; color: #c0392b; }
.okp-message.okp-success { background: #eafaf1; color: #1e8449; }

/* ---- 見積書ビュー ---- */
.okp-quote-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 16px;
	flex-wrap: wrap;
	border-bottom: 2px solid #2e5c8a;
	padding-bottom: 12px;
}
.okp-quote-header-left { flex: 1; min-width: 240px; }
.okp-quote-title { font-size: 22px; font-weight: 600; margin: 0 0 8px; color: #2e5c8a; }
.okp-meta { font-size: 13px; color: #555; margin: 0 0 2px; line-height: 1.5; }

.okp-issuer { text-align: right; font-size: 13px; color: #555; min-width: 240px; }
.okp-issuer p { margin: 0 0 2px; line-height: 1.5; }
.okp-issuer-name { font-weight: 600; color: #222; font-size: 15px; margin-bottom: 4px !important; }
.okp-issuer-logo { max-height: 48px; width: auto; margin-bottom: 8px; }

.okp-box {
	background: #f7f9fb;
	border-radius: 6px;
	padding: 12px 14px;
	font-size: 13px;
}
.okp-box p { margin: 0 0 3px; line-height: 1.5; }
.okp-box-title { font-size: 12px; color: #888; margin: 0 0 6px !important; }

.okp-items-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 14px 0; border: 2px solid #2e5c8a; }
.okp-items-table th {
	background: #2e5c8a;
	color: #fff;
	font-weight: 600;
	padding: 8px 10px;
	text-align: left;
	font-size: 13px;
	border: 1px solid #2e5c8a;
}
.okp-items-table td {
	padding: 8px 10px;
	border: 1px solid #b9c7d6;
	font-size: 13px;
}
.okp-right { text-align: right; }

/* 合計枠を表の右側に寄せる */
.okp-totals-row { display: flex; justify-content: flex-end; margin: 14px 0; }
.okp-note-box {
	font-size: 13px;
	margin-top: 14px;
	border: 1px solid #ccc;
	border-radius: 4px;
	padding: 10px 14px;
	background: #fafafa;
}
.okp-note-box p { margin: 0 0 4px; }
.okp-totals { font-size: 14px; width: 320px; border-collapse: collapse; border: 2px solid #2e5c8a; }
.okp-totals td { padding: 7px 12px; border: 1px solid #b9c7d6; }
.okp-total-row td { border-top: 2px solid #2e5c8a; font-weight: 600; font-size: 15px; }

.okp-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.okp-actions > * { flex: 1; min-width: 120px; margin: 0; }
.okp-small-note { font-size: 12px; color: #888; margin-top: 8px; }

/* ==========================================================================
   印刷・PDF出力用(1ページに収める)
   ご依頼商品の行数が多い場合は自動的に縮小して1枚に収めます。
   ========================================================================== */
@media print {
	/* サイト共通のヘッダー・フッター・メニュー・ボタン類を全て隠す。
	   テーマによってクラス名が異なる場合は、印刷時に不要な要素のクラスを
	   下に追記してください。 */
	header, footer, nav,
	.site-header, .site-footer, .global-nav, .l-header, .l-footer,
	#header, #footer, .breadcrumb, .breadcrumbs,
	.okp-actions,
	#okp-add-item,
	.okp-quote-form {
		display: none !important;
	}

	/* ページ余白を最小限にして印刷領域を最大化 */
	@page {
		size: A4 portrait;
		margin: 8mm;
	}

	html, body {
		margin: 0 !important;
		padding: 0 !important;
		background: #fff !important;
	}

	/* 見積書本体だけを画面いっぱいに表示し、はみ出しを防ぐ */
	.okp-quote-view {
		max-width: 100% !important;
		width: 100% !important;
		margin: 0 !important;
		padding: 0 !important;
		border: none !important;
		box-shadow: none !important;
		font-size: 11px !important;
		line-height: 1.4 !important;
	}

	.okp-quote-view * {
		-webkit-print-color-adjust: exact !important;
		print-color-adjust: exact !important;
	}

	/* 1ページに収めるため、各要素を少しコンパクトにする */
	.okp-quote-title { font-size: 18px !important; }
	.okp-meta, .okp-issuer p, .okp-box p, .okp-box-title { font-size: 11px !important; }
	.okp-items-table th, .okp-items-table td { padding: 5px 8px !important; font-size: 11px !important; }
	.okp-totals td { padding: 4px 8px !important; }
	.okp-quote-header { padding-bottom: 8px !important; }
	.okp-grid-2 { margin: 10px 0 !important; }

	/* 表の途中でページが切れないようにする */
	.okp-items-table, .okp-quote-header, .okp-totals-row, .okp-note-box { page-break-inside: avoid; }
	tr { page-break-inside: avoid; }
}
