/*
 * জমির হিসাব — the unit-conversion popup on the homepage. Uses the site's own tokens from style.css.
 * Loaded on the homepage only.
 */

.lc-modal {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.lc-modal[hidden] {
	display: none;
}

.lc-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(14, 34, 22, 0.55);
}

.lc-dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 560px;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	border-radius: var(--radius-md);
	background: var(--color-white);
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
	overflow: hidden;
}

.lc-dialog:focus {
	outline: none;
}

.lc-dialog__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 18px 10px;
	background: var(--color-cream);
	border-bottom: 1px solid var(--color-border);
}

.lc-dialog__eyebrow {
	margin: 0 0 2px;
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--color-green);
}

.lc-dialog__head h2 {
	margin: 0;
	font-size: clamp(1.15rem, 1.05rem + 0.5vw, 1.35rem);
	line-height: 1.35;
	color: var(--color-heading);
}

.lc-dialog__close {
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	border: 1px solid var(--color-border);
	border-radius: 50%;
	background: var(--color-white);
	font-size: 1.3rem;
	line-height: 1;
	color: var(--color-heading);
	cursor: pointer;
}

.lc-dialog__close:hover {
	border-color: var(--color-green);
	color: var(--color-green);
}

.lc-dialog__body {
	flex: 1;
	min-height: 0;
	padding: 14px 18px 18px;
	overflow-y: auto;
}

.lc-hint {
	margin: 0 0 12px;
	font-size: 0.88rem;
	line-height: 1.6;
	color: #566760;
}

.lc-form {
	display: grid;
	grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
	gap: 12px;
}

.lc-field label {
	display: block;
	margin-bottom: 4px;
	font-size: 0.88rem;
	font-weight: 600;
	color: var(--color-heading);
}

.lc-field input,
.lc-field select {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #CFD3C8;
	border-radius: var(--radius-sm);
	background: var(--color-white);
	font: inherit;
	font-size: 1rem;
	color: var(--color-heading);
}

.lc-field input:focus,
.lc-field select:focus {
	outline: none;
	border-color: var(--color-green);
	box-shadow: 0 0 0 3px rgba(25, 128, 48, 0.15);
}

.lc-msg {
	margin: 10px 0 0;
	padding: 8px 12px;
	border-radius: var(--radius-sm);
	background: #FDECEA;
	font-size: 0.9rem;
	color: #A8271F;
}

.lc-msg[hidden] {
	display: none;
}

.lc-results {
	margin: 14px 0 0;
	padding: 0;
	list-style: none;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	overflow: hidden;
}

.lc-results:empty {
	display: none;
}

.lc-result {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	padding: 9px 14px;
}

.lc-result + .lc-result {
	border-top: 1px solid var(--color-border);
}

.lc-result-head {
	padding: 7px 14px;
	border-top: 1px solid var(--color-border);
	background: var(--color-cream);
	font-size: 0.8rem;
	font-weight: 700;
	color: var(--color-green-deep);
}

.lc-result-head:first-child {
	border-top: 0;
}

.lc-result.is-from {
	background: var(--color-soft-green);
}

.lc-result__name {
	font-size: 0.95rem;
	color: var(--color-heading);
}

.lc-result__val {
	font-family: var(--font-en);
	font-size: 1.05rem;
	font-weight: 700;
	color: var(--color-green-deep);
	text-align: right;
	word-break: break-all;
}

.lc-note {
	margin: 14px 0 0;
	font-size: 0.8rem;
	line-height: 1.6;
	color: #566760;
}

.lc-region {
	margin: 0;
	padding: 7px 18px;
	background: var(--color-soft-green);
	border-bottom: 1px solid var(--color-border);
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--color-green-deep);
}

/* ---- tabs ---- */

.lc-tabs {
	display: flex;
	gap: 6px;
	padding: 10px 18px 0;
	border-bottom: 1px solid var(--color-border);
	background: var(--color-white);
}

.lc-tab {
	margin-bottom: -1px;
	padding: 8px 14px;
	border: 1px solid transparent;
	border-bottom: 0;
	border-radius: var(--radius-sm) var(--radius-sm) 0 0;
	background: none;
	font: inherit;
	font-size: 0.95rem;
	font-weight: 600;
	color: #566760;
	cursor: pointer;
}

.lc-tab:hover {
	color: var(--color-green);
}

.lc-tab.is-on {
	border-color: var(--color-border);
	background: var(--color-white);
	border-bottom: 1px solid var(--color-white);
	color: var(--color-green);
}

/* ---- area from the sides ---- */

.lc-shapes {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 12px;
}

.lc-chip {
	padding: 5px 14px;
	border: 1.5px solid #9AA8A0;
	border-radius: 999px;
	background: var(--color-white);
	font: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--color-heading);
	cursor: pointer;
}

.lc-chip:hover {
	border-color: var(--color-green);
}

.lc-chip.is-on {
	border-color: var(--color-green);
	background: var(--color-green);
	color: #fff;
}

.lc-area-grid {
	display: grid;
	grid-template-columns: 150px minmax(0, 1fr);
	gap: 16px;
	align-items: start;
}

.lc-diagram {
	padding: 6px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	background: var(--color-cream);
}

.lc-diagram svg {
	display: block;
	width: 100%;
	height: auto;
}

.lc-diagram text {
	font-family: inherit;
	font-size: 13px;
	font-weight: 700;
	fill: var(--color-heading);
}

.lc-field--unit {
	margin-bottom: 10px;
}

.lc-sides {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px 10px;
}

.lc-field--side label {
	margin-bottom: 1px;
}

.lc-field--side small {
	display: block;
	margin-bottom: 4px;
	font-size: 0.76rem;
	line-height: 1.4;
	color: #566760;
}

.lc-shapehint {
	margin: -4px 0 12px;
	font-size: 0.86rem;
	line-height: 1.55;
	color: var(--color-heading);
}

.lc-note--quad {
	margin-top: 10px;
}

.lc-note[hidden] {
	display: none;
}

body.lc-open {
	overflow: hidden;
}

@media (max-width: 560px) {
	.lc-modal {
		padding: 0;
		align-items: flex-end;
	}

	.lc-dialog {
		max-width: none;
		max-height: 94vh;
		max-height: 94dvh;
		border-radius: var(--radius-md) var(--radius-md) 0 0;
	}

	.lc-dialog__head,
	.lc-dialog__body,
	.lc-region,
	.lc-tabs {
		padding-left: 16px;
		padding-right: 16px;
	}

	.lc-area-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.lc-diagram {
		max-width: 190px;
	}
}

.lc-dialog__foot {
	padding: 10px 18px 12px;
	border-top: 1px solid var(--color-border);
	background: var(--color-cream);
}

.lc-print {
	width: 100%;
	padding: 10px 18px;
	font-size: 0.98rem;
}

.lc-print:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.lc-hint--small {
	margin: 8px 0 0;
	font-size: 0.78rem;
}

/* the printed slip stays out of sight on screen */
.lc-sheet {
	display: none;
}

/* =====================================================================
 * Print: only the slip — a compact half-A4 with a dashed cut line.
 * ================================================================== */

@media print {
	@page {
		size: A4 portrait;
		margin: 10mm 12mm;
	}

	body.lc-open > *:not(.lc-modal) {
		display: none !important;
	}

	.lc-modal {
		position: static;
		display: block;
		padding: 0;
	}

	.lc-modal__backdrop,
	.lc-dialog {
		display: none !important;
	}

	body.lc-open {
		overflow: visible;
		background: #fff !important;
		color: #000;
		font-size: 10pt;
	}

	.lc-sheet {
		display: block;
		padding: 6mm 7mm 5mm;
		border: 0.8pt dashed #8A8A8A;
		color: #111;
		break-inside: avoid;
	}

	.lc-sheet__head {
		display: flex;
		justify-content: space-between;
		align-items: flex-start;
		gap: 14pt;
		padding-bottom: 6pt;
		border-bottom: 1.6pt solid #198030;
	}

	.lc-sheet__org {
		margin: 0;
		font-size: 17pt;
		font-weight: 800;
		line-height: 1.3;
		color: #198030;
	}

	.lc-sheet__role {
		margin: 1pt 0 0;
		font-size: 10.5pt;
		font-weight: 600;
		color: #222;
	}

	.lc-sheet__phone {
		text-align: right;
		line-height: 1.3;
		white-space: nowrap;
	}

	.lc-sheet__phone-label {
		display: block;
		font-size: 7.5pt;
		color: #555;
	}

	.lc-sheet__phone strong {
		display: block;
		font-family: var(--font-en);
		font-size: 13.5pt;
		letter-spacing: 0.03em;
		color: #000;
	}

	.lc-sheet__channels {
		display: block;
		font-family: var(--font-en);
		font-size: 8.5pt;
		font-weight: 600;
		color: #198030;
	}

	.lc-sheet__title {
		margin: 8pt 0 2pt;
		font-size: 13pt;
		line-height: 1.4;
		color: #000;
	}

	.lc-sheet__date {
		margin: 0 0 6pt;
		font-size: 9.5pt;
	}

	.lc-sheet h3 {
		margin: 6pt 0 3pt;
		font-size: 10pt;
		color: #0f6023;
	}

	.lc-sheet__cols {
		display: flex;
		justify-content: space-between;
		align-items: flex-start;
		gap: 14pt;
	}

	.lc-sheet__inputs {
		margin: 0;
		padding: 0;
		list-style: none;
		font-size: 10.5pt;
		line-height: 1.55;
	}

	.lc-sheet__diagram {
		flex: 0 0 34mm;
	}

	.lc-sheet__diagram svg {
		display: block;
		width: 100%;
		height: auto;
		border: 0.5pt solid #C4C4C4;
	}

	.lc-sheet__diagram text {
		font-size: 12px;
		font-weight: 700;
		fill: #000;
	}

	.lc-sheet__table {
		width: 100%;
		border-collapse: collapse;
		font-size: 10.5pt;
	}

	.lc-sheet__table th,
	.lc-sheet__table td {
		padding: 3pt 6pt;
		border-bottom: 0.5pt solid #C4C4C4;
	}

	.lc-sheet__table th {
		text-align: left;
		font-weight: 500;
	}

	.lc-sheet__table td {
		text-align: right;
		font-family: var(--font-en);
		font-weight: 700;
	}

	.lc-sheet__table tr.is-head th {
		padding-top: 6pt;
		font-size: 9pt;
		font-weight: 700;
		color: #0f6023;
		text-align: left;
	}

	.lc-sheet__table tr.is-from th,
	.lc-sheet__table tr.is-from td {
		font-weight: 800;
		border-bottom: 1pt solid #198030;
	}

	.lc-sheet__foot {
		margin: 6pt 0 0;
		padding-top: 4pt;
		border-top: 0.5pt solid #C4C4C4;
		font-size: 7.5pt;
		color: #555;
	}
}

/* ---- নকশা থেকে মাপ ---- */
.lm-file { width: 100%; box-sizing: border-box; padding: 8px; border: 1px dashed #98a79c; border-radius: 8px; background: #fff; font-size: 14px; margin: 4px 0 10px; }
.lm-pdfbar { display: flex; gap: 8px; align-items: center; font-size: 13px; margin: 0 0 8px; }
.lm-pdfbar input { width: 64px; padding: 4px 6px; }
.lm-tools { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.lm-btn { border: 1px solid #198030; background: #fff; color: #0f6023; border-radius: 8px; padding: 7px 11px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.lm-btn.is-on { background: #198030; color: #fff; }
.lm-btn--sm { border-color: #cfd8d2; color: #2c3d44; font-weight: 500; padding: 6px 9px; }
.lm-step { font-size: 13px; color: #0f6023; background: #f2f8f2; border-radius: 8px; padding: 7px 10px; margin: 0 0 8px; }
.lm-step:empty { display: none; }
.lm-stage { border: 1px solid #cfd8d2; border-radius: 10px; overflow: hidden; background: #e9ece8; }
.lm-stage canvas { display: block; max-width: 100%; touch-action: none; }
.lm-scalebox { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: 10px 0; padding: 10px; border: 1px solid #f1d9a6; background: #fff8e6; border-radius: 10px; font-size: 13px; }
.lm-scalebox label { display: grid; gap: 3px; font-weight: 600; }
.lm-scalebox input, .lm-scalebox select { padding: 7px 9px; border: 1px solid #98a79c; border-radius: 6px; font: inherit; }
.lc-msg.is-bad { color: #b42318; }
.lm-scalebox[hidden], .lm-pdfbar[hidden], .lm-tools[hidden], .lm-stage[hidden], .lm-step[hidden] { display: none !important; }
.lm-btn.is-locked { opacity: .5; border-style: dashed; cursor: not-allowed; }

/* map tab: workspace additions */
.lm-snap { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; padding: 0 6px; }
.lm-dags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; align-items: center; }
.lm-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #b8cbbd; background: #fff; border-radius: 999px; padding: 4px 10px; font-size: 13px; cursor: pointer; }
.lm-chip.is-on { background: #198030; color: #fff; border-color: #198030; }
.lm-chip button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; padding: 0; }
.lm-chip-hint { font-size: 11.5px; color: #6e7d77; }
.lm-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.lm-status { background: #14532d; color: #fff; border-radius: 8px; padding: 9px 12px; font-size: 13.5px; font-weight: 600; margin: 8px 0; }
.lm-dags[hidden], .lm-actions[hidden], .lm-status[hidden] { display: none !important; }
body.lm-noscroll { overflow: hidden; }
.lm-full { position: fixed; inset: 0; z-index: 100000; background: #fff; padding: 12px 16px; overflow: auto; display: flex; flex-direction: column; gap: 6px; box-sizing: border-box; }
.lm-full .lm-stage { flex: 0 0 auto; height: calc(100vh - 290px); min-height: 320px; }
.lm-full .lc-hint, .lm-full .lc-note, .lm-full .lm-file { display: none; }
.lm-full .lc-results { max-height: 26vh; overflow: auto; }

.lm-snap select { margin-left: 4px; padding: 4px 6px; border: 1px solid #98a79c; border-radius: 6px; font: inherit; font-size: 13px; }
.lm-summary { display: grid; gap: 10px; margin: 10px 0; }
.lm-card { border: 1px solid #b8cbbd; background: #f2f8f2; border-radius: 12px; padding: 12px 14px; }
.lm-card--total { background: #14532d; color: #fff; border-color: #14532d; }
.lm-card--total .lm-big, .lm-card--total .lm-sub { color: #fff; }
.lm-card__t { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.lm-big { font-size: 30px; font-weight: 800; color: #14532d; line-height: 1.15; }
.lm-big small { font-size: 15px; font-weight: 600; }
.lm-sub { font-size: 14px; font-weight: 600; color: #2c3d44; margin-top: 2px; }
.lm-sub2 { font-size: 13px; color: #4b5b55; margin-top: 4px; }
.lm-det { margin-top: 8px; font-size: 13px; }
.lm-det summary { cursor: pointer; color: #0f6023; font-weight: 600; }
.lm-tab { width: 100%; border-collapse: collapse; margin-top: 6px; background: #fff; }
.lm-tab th, .lm-tab td { border: 1px solid #dbe4dd; padding: 4px 8px; text-align: right; }
.lm-tab th:first-child, .lm-tab td:first-child { text-align: center; }
.lm-tab th { background: #eaf4ec; }
.lm-summary:empty { display: none; }

.lm-err { border-radius: 10px; padding: 10px 12px; font-size: 13.5px; border: 1px solid; margin: 0 0 8px; line-height: 1.5; }
.lm-err em { display: block; font-style: normal; font-weight: 400; margin-top: 3px; }
.lm-err--ok { background: #ecf8ee; border-color: #8cc79a; color: #14532d; }
.lm-err--mid { background: #fff8e6; border-color: #f1d9a6; color: #7a4b00; }
.lm-err--bad { background: #fdecec; border-color: #f0b4ae; color: #8a1c14; }
.lm-verify { font-size: 13px; margin: 0 0 8px; padding: 8px 10px; background: #f6f6f1; border: 1px solid #e3e1d6; border-radius: 8px; }
.lm-verify input { width: 90px; padding: 4px 6px; border: 1px solid #98a79c; border-radius: 6px; font: inherit; }
.lm-verify .is-ok { color: #14532d; font-weight: 700; } .lm-verify .is-mid { color: #7a4b00; font-weight: 700; } .lm-verify .is-bad { color: #b42318; font-weight: 700; }

/* printed report for the map tab: the traced map is shown large */
.lc-sheet--map .lc-sheet__cols { display: block; }
.lc-sheet--map .lc-sheet__diagram { width: 100%; max-width: none; margin: 10px 0; text-align: center; }
.lc-sheet--map .lc-sheet__diagram img { width: 100%; max-height: 120mm; object-fit: contain; border: 1px solid #cfd8d2; }
