.insaatim-hesap-wrap {
	--ih-bg: #ffffff;
	--ih-fg: #1a1a1a;
	--ih-muted: #6b7280;
	--ih-border: #b9bcc2;
	--ih-header-bg: #d9d9d9;
	--ih-section-bg: #f2f2f2;
	--ih-input-bg: transparent;
	--ih-btn-bg: #1a1a1a;
	--ih-btn-fg: #ffffff;
	--ih-btn-secondary-bg: #e5e7eb;
	--ih-btn-secondary-fg: #1a1a1a;
	--ih-warn: #b45309;
	--ih-total-bg: #f2f2f2;
	--ih-final-bg: #1a1a1a;
	--ih-final-fg: #ffffff;

	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--ih-fg);
	background: var(--ih-bg);
	max-width: 980px;
	margin: 20px auto;
	line-height: 1.5;
	padding: 24px;
	border: 1px solid var(--ih-border);
	border-radius: 4px;
}

@media (prefers-color-scheme: dark) {
	.insaatim-hesap-wrap:not([data-theme="light"]) {
		--ih-bg: #1a1a1a; --ih-fg: #e5e7eb; --ih-muted: #9ca3af; --ih-border: #444;
		--ih-header-bg: #2c2c2c; --ih-section-bg: #262626; --ih-total-bg: #262626;
		--ih-btn-bg: #e5e7eb; --ih-btn-fg: #14161a; --ih-btn-secondary-bg: #333; --ih-btn-secondary-fg: #e5e7eb;
		--ih-final-bg: #e5e7eb; --ih-final-fg: #14161a;
	}
}

.insaatim-hesap-wrap * { box-sizing: border-box; }

.insaatim-hesap-topbar {
	display: flex;
	justify-content: flex-end;
	margin-bottom: 8px;
}
.insaatim-hesap-donem-box {
	border: 1px solid var(--ih-border);
	border-radius: 4px;
	overflow: hidden;
	display: flex;
	font-size: 0.92rem;
}
.insaatim-hesap-donem-box .label {
	background: var(--ih-bg);
	padding: 8px 14px;
	font-weight: 500;
}
.insaatim-hesap-donem-box .value {
	background: var(--ih-section-bg);
	padding: 8px 14px;
	font-weight: 700;
	display: flex;
	gap: 4px;
	align-items: center;
	cursor: pointer;
}
.insaatim-hesap-donem-box select {
	border: none;
	background: transparent;
	font-weight: 700;
	font-size: 0.92rem;
	color: var(--ih-fg);
	cursor: pointer;
}

.insaatim-hesap-title {
	text-align: center;
	font-size: 1.6rem;
	font-weight: 700;
	letter-spacing: 0.02em;
	margin: 4px 0 22px;
}

.insaatim-hesap-wrap table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.92rem;
	margin-bottom: 18px;
}
.insaatim-hesap-wrap th, .insaatim-hesap-wrap td {
	border: 1px solid var(--ih-border);
	padding: 10px 12px;
	text-align: left;
	vertical-align: middle;
}
.insaatim-hesap-wrap thead th {
	background: var(--ih-header-bg);
	font-weight: 700;
}

.insaatim-hesap-wrap input[type="text"],
.insaatim-hesap-wrap input[type="number"] {
	border: none;
	background: var(--ih-input-bg);
	color: var(--ih-fg);
	font-size: inherit;
	font-family: inherit;
	width: 100%;
	padding: 2px 4px;
	border-radius: 3px;
}
.insaatim-hesap-wrap input[type="text"]:focus,
.insaatim-hesap-wrap input[type="number"]:focus {
	outline: 2px solid #93c5fd;
	background: rgba(147,197,253,0.12);
}
.insaatim-hesap-wrap td.num input { text-align: right; }
.insaatim-hesap-wrap td.num, .insaatim-hesap-wrap th.num { text-align: right; }
.insaatim-hesap-wrap td.miktar-cell input { min-width: 90px; text-align: center; }
.insaatim-hesap-wrap .birim-input { max-width: 70px; }
.insaatim-hesap-wrap .fiyat-input-manual { width: 100%; text-align: right; }
.insaatim-hesap-wrap th.miktar-col { min-width: 100px; }

.insaatim-hesap-poz-cell {
	display: flex;
	align-items: center;
	gap: 4px;
}
.insaatim-hesap-poz-cell input { flex: 1; }
.insaatim-hesap-poz-cell .insaatim-hesap-remove {
	flex: 0 0 auto;
	opacity: 0.55;
}
.insaatim-hesap-poz-cell .insaatim-hesap-remove:hover { opacity: 1; }

textarea.insaatim-hesap-autogrow {
	border: none;
	background: var(--ih-input-bg);
	color: var(--ih-fg);
	font-size: inherit;
	font-family: inherit;
	width: 100%;
	padding: 2px 4px;
	border-radius: 3px;
	resize: none;
	overflow: hidden;
	min-height: 1.6em;
	line-height: 1.4;
	display: block;
}
textarea.insaatim-hesap-autogrow:focus {
	outline: 2px solid #93c5fd;
	background: rgba(147,197,253,0.12);
}

tr.insaatim-hesap-section td {
	background: var(--ih-section-bg);
	font-weight: 700;
	border-left: 1px solid var(--ih-border);
	border-right: 1px solid var(--ih-border);
}

.insaatim-hesap-muted { color: var(--ih-muted); }
.insaatim-hesap-endeks-flag { font-size: 0.72rem; color: var(--ih-warn); display: block; }

.insaatim-hesap-remove {
	background: transparent;
	color: var(--ih-warn);
	border: none;
	cursor: pointer;
	font-size: 1rem;
	padding: 2px 6px;
}

.insaatim-hesap-wrap table.insaatim-hesap-totals { width: 55%; margin-left: auto; margin-right: 0; }
.insaatim-hesap-totals td:first-child { font-weight: 500; }
.insaatim-hesap-totals td:last-child { text-align: right; font-weight: 700; }
.insaatim-hesap-totals tr.total-ara td { background: var(--ih-total-bg); }
.insaatim-hesap-totals tr.total-kar td { background: var(--ih-total-bg); }
.insaatim-hesap-totals tr.total-final td { background: var(--ih-final-bg); color: var(--ih-final-fg); font-size: 1.05rem; }

.insaatim-hesap-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	margin-top: 20px;
	padding-top: 16px;
	border-top: 1px dashed var(--ih-border);
}
.insaatim-hesap-wrap button.ih-btn {
	cursor: pointer;
	border: 1px solid var(--ih-border);
	border-radius: 6px;
	padding: 8px 16px;
	font-size: 0.88rem;
	font-weight: 600;
	background: var(--ih-btn-secondary-bg);
	color: var(--ih-btn-secondary-fg);
}
.insaatim-hesap-wrap button.ih-btn.primary {
	background: var(--ih-btn-bg);
	color: var(--ih-btn-fg);
	border-color: var(--ih-btn-bg);
}

.insaatim-hesap-login-notice {
	background: #fef3c7;
	color: #78350f;
	padding: 14px 18px;
	border-radius: 10px;
	max-width: 980px;
	margin: 20px auto;
}
.insaatim-hesap-loading {
	color: var(--ih-muted);
	font-style: italic;
	padding: 10px 0;
}

@media (max-width: 700px) {
	.insaatim-hesap-wrap { padding: 14px; }
	.insaatim-hesap-wrap table, .insaatim-hesap-wrap thead, .insaatim-hesap-wrap tbody, .insaatim-hesap-wrap tr { display: block; width: 100%; }
	.insaatim-hesap-wrap thead { display: none; }
	.insaatim-hesap-wrap tbody tr { margin-bottom: 10px; border: 1px solid var(--ih-border); border-radius: 6px; }
	.insaatim-hesap-wrap tbody td { display: flex; justify-content: space-between; gap: 10px; border: none; border-bottom: 1px solid var(--ih-border); }
	.insaatim-hesap-wrap tbody td:last-child { border-bottom: none; }
	tr.insaatim-hesap-section { border: none !important; }
	tr.insaatim-hesap-section td { display: block; }
}

/* --- Yazdırma: sayfanın geri kalanı (reklamlar dahil) JS ile (isolateForPrint)
   gizleniyor - burada sadece wrap'ın kendi görünümünü sadeleştiriyoruz.
   ÖNEMLİ: position:absolute KULLANILMIYOR - uzun analizlerde içeriği tek
   sayfaya kırpıp geri kalanını keser, doğal akışta bırakmak gerekiyor. */
@media print {
	.insaatim-hesap-wrap {
		border: none;
		margin: 0;
		padding: 6px 0;
		max-width: 100% !important;
	}
	.insaatim-hesap-actions,
	.ih-no-print,
	.insaatim-hesap-donem-box .value select { display: none !important; }
	.insaatim-hesap-donem-box .value::after {
		content: attr(data-print-label);
	}
	.insaatim-hesap-remove { display: none !important; }
	.insaatim-hesap-wrap input, .insaatim-hesap-wrap textarea { border: none !important; outline: none !important; background: none !important; }
}
