/* PDF Measure Tool — UI styles (Profile Equipment palette) */

.pmt-app {
	--bg: #17150e;
	--panel: rgba(255, 255, 255, .03);
	--panel-solid: #1f1c14;
	--line: rgba(255, 255, 255, .09);
	--line-strong: rgba(255, 255, 255, .16);
	--text: #f5f1e6;
	--muted: #b0aa96;
	--muted-2: #8f8970;
	--accent: #c2a202;
	--accent-hover: #d9b503;
	--on-accent: #17150e;
	--field: rgba(0, 0, 0, .28);
	--warn: #e8a13a;

	display: flex;
	flex-direction: column;
	height: 82vh;
	min-height: 420px;
	overflow: hidden;
	background: var(--bg);
	color: var(--text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 13px;
}
.pmt-app *, .pmt-app *::before, .pmt-app *::after { box-sizing: border-box; }
.pmt-app button, .pmt-app input, .pmt-app select, .pmt-app textarea { font-family: inherit; }
.pmt-app :focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.pmt-boot {
	padding: 24px;
	text-align: center;
	color: var(--muted);
}

/* ---------- topbar ---------- */
.pmt-topbar {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 8px;
	background: var(--panel);
	border-bottom: 1px solid var(--line);
	flex-wrap: wrap;
}
.pmt-sep { width: 1px; height: 22px; background: var(--line-strong); margin: 0 4px; }
.pmt-status {
	margin-left: auto;
	color: var(--muted);
	font-size: 12px;
	max-width: 46ch;
	text-align: right;
	line-height: 1.35;
}
.pmt-unitlabel { display: flex; align-items: center; gap: 4px; color: var(--muted); }

.pmt-name {
	background: var(--field);
	border: 1px solid var(--line-strong);
	color: var(--text);
	padding: 5px 8px;
	border-radius: 4px;
	min-width: 160px;
	font-size: 12px;
}

/* ---------- buttons ---------- */
.pmt-btn {
	background: rgba(255, 255, 255, .06);
	border: 1px solid var(--line-strong);
	color: var(--text);
	padding: 5px 10px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 12px;
	line-height: 1.2;
}
.pmt-btn:hover { background: rgba(255, 255, 255, .12); }
.pmt-btn.pmt-primary {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--on-accent);
	font-weight: 600;
}
.pmt-btn.pmt-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.pmt-btn.pmt-danger { background: rgba(190, 60, 45, .28); border-color: rgba(220, 90, 70, .5); }
.pmt-btn.pmt-danger:hover { background: rgba(190, 60, 45, .5); }
.pmt-btn.pmt-mini { padding: 2px 7px; font-size: 11px; }
.pmt-btn.pmt-full { width: 100%; margin-top: 8px; }
.pmt-btn.pmt-grow { flex: 1; text-align: left; }

.pmt-select,
.pmt-input,
.pmt-color {
	background: var(--field);
	border: 1px solid var(--line-strong);
	color: var(--text);
	padding: 4px 6px;
	border-radius: 4px;
	font-size: 12px;
}
.pmt-select option { background: #17150e; color: #f5f1e6; }
.pmt-input { width: 100%; }
.pmt-input.pmt-small { width: 70px; }
.pmt-input.pmt-grow { flex: 1; }
.pmt-color { width: 36px; height: 28px; padding: 1px; }
textarea.pmt-input { resize: vertical; }

/* ---------- body ---------- */
.pmt-body { flex: 1; display: flex; min-height: 0; }

/* ---------- toolbar ---------- */
.pmt-toolbar {
	width: 116px;
	flex-shrink: 0;
	background: var(--panel);
	border-right: 1px solid var(--line);
	padding: 6px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	overflow-y: auto;
}
.pmt-tool {
	background: rgba(255, 255, 255, .06);
	border: 1px solid var(--line-strong);
	color: var(--text);
	padding: 7px 6px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 12px;
	text-align: left;
	flex-shrink: 0;
}
.pmt-tool:hover { background: rgba(255, 255, 255, .12); }
.pmt-tool.active {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--on-accent);
	font-weight: 600;
}

/* ---------- canvas ---------- */
.pmt-canvas-wrap {
	flex: 1;
	display: flex;
	flex-direction: column;
	position: relative;
	min-width: 0;
	min-height: 0;
	background: #100f0a;
}
.pmt-canvas { flex: 1; min-height: 0; overflow: hidden; touch-action: none; }
.pmt-canvas canvas { display: block; }

.pmt-drop {
	position: absolute;
	top: 0; left: 0; right: 0; bottom: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--muted);
	text-align: center;
	padding: 20px;
}
.pmt-drop-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding: 28px 32px;
	border: 1px dashed var(--line-strong);
	border-radius: 8px;
	background: var(--panel);
	max-width: 420px;
}
.pmt-drop-title { color: var(--text); font-size: 16px; font-weight: 600; }

.pmt-pagebar {
	min-height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 10px;
	padding: 4px 8px;
	background: var(--panel);
	border-top: 1px solid var(--line);
}
.pmt-pageinfo { color: var(--muted); min-width: 110px; text-align: center; }
.pmt-scaleinfo { color: var(--muted-2); font-size: 11px; }
.pmt-warn, .pmt-scaleinfo.pmt-warn { color: var(--warn); }

/* ---------- side ---------- */
.pmt-side {
	width: 312px;
	flex-shrink: 0;
	background: transparent;
	border-left: 1px solid var(--line);
	overflow-y: auto;
	padding: 8px;
}
.pmt-section {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 5px;
	padding: 8px;
	margin-bottom: 8px;
}
.pmt-section-title {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-weight: 600;
	color: var(--accent);
	margin-bottom: 8px;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.1em;
}
.pmt-hint { color: var(--muted-2); font-size: 11px; margin: 6px 0 0; line-height: 1.5; }
.pmt-hint.pmt-warn { color: var(--warn); }
.pmt-hint:empty { display: none; }
.pmt-message { margin: 0; line-height: 1.55; color: var(--text); }

.pmt-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-bottom: 8px;
	color: var(--muted);
	font-size: 11px;
}
.pmt-field.pmt-inline { flex-direction: row; align-items: center; }
.pmt-row { display: flex; align-items: center; gap: 6px; }
.pmt-grow { flex: 1; min-width: 0; }
.pmt-readout {
	background: var(--field);
	border: 1px solid var(--line-strong);
	border-radius: 4px;
	padding: 6px 8px;
	margin-bottom: 8px;
	word-break: break-word;
}
.pmt-readout-type {
	color: var(--muted-2);
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: .1em;
	margin-bottom: 3px;
}
.pmt-readout-line { display: flex; justify-content: space-between; gap: 10px; padding: 1px 0; }
.pmt-readout-line span { color: var(--muted); }
.pmt-readout-line b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- colour palette ---------- */
.pmt-palette { display: flex; flex-wrap: wrap; gap: 4px; }
.pmt-swatch {
	width: 20px; height: 20px;
	border-radius: 3px;
	border: 2px solid rgba(255, 255, 255, .15);
	cursor: pointer;
	padding: 0;
}
.pmt-swatch.active { border-color: #fff; }

/* ---------- legend ---------- */
.pmt-legend-row {
	border: 1px solid var(--line);
	border-radius: 4px;
	padding: 6px;
	margin-bottom: 6px;
	background: rgba(0, 0, 0, .18);
}
.pmt-legend-head { display: flex; align-items: center; gap: 6px; }
.pmt-legend-grid {
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 6px;
	margin: 6px 0;
}
.pmt-legend-grid label {
	display: flex;
	flex-direction: column;
	gap: 2px;
	font-size: 10px;
	color: var(--muted-2);
}
.pmt-legend-total {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	font-size: 11px;
	color: var(--muted);
	border-top: 1px solid var(--line);
	padding-top: 4px;
}
.pmt-legend-total strong { color: var(--accent); font-variant-numeric: tabular-nums; }

/* ---------- modal ---------- */
.pmt-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.66);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 99999;
}
.pmt-modal {
	background: var(--panel-solid);
	border: 1px solid var(--line-strong);
	border-radius: 6px;
	width: 400px;
	max-width: 92vw;
	max-height: 86vh;
	overflow-y: auto;
	color: var(--text);
	font-size: 13px;
}
.pmt-modal-title {
	padding: 10px 14px;
	font-weight: 600;
	border-bottom: 1px solid var(--line);
}
.pmt-modal-body { padding: 14px; }
.pmt-modal-buttons {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	padding: 10px 14px;
	border-top: 1px solid var(--line);
}
.pmt-modal.pmt-modal--wide { width: 760px; }

/* ---------- help ---------- */
.pmt-help { font-size: 13px; line-height: 1.6; color: var(--text); }
.pmt-help h2 { font-size: 15px; color: var(--accent); margin: 20px 0 6px; }
.pmt-help h2:first-of-type { margin-top: 0; }
.pmt-help h3 { font-size: 13px; color: var(--text); margin: 12px 0 4px; }
.pmt-help p { margin: 6px 0; }
.pmt-help ul, .pmt-help ol { margin: 6px 0; padding-left: 22px; }
.pmt-help li { margin: 3px 0; }
.pmt-help code {
	background: var(--field); border: 1px solid var(--line);
	border-radius: 3px; padding: 1px 4px; font-size: 12px;
}
.pmt-help kbd {
	background: rgba(255, 255, 255, .08); border: 1px solid var(--line-strong);
	border-radius: 3px; padding: 1px 6px; font-size: 11px; font-family: inherit;
}
.pmt-help table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.pmt-help th, .pmt-help td {
	border: 1px solid var(--line-strong); padding: 5px 8px;
	text-align: left; font-size: 12px; vertical-align: top;
}
.pmt-help th { background: rgba(255, 255, 255, .06); color: var(--text); }

.pmt-list-row,
.pmt-list { display: flex; flex-direction: column; gap: 6px; }
.pmt-list { margin-top: 10px; }
.pmt-list-row { flex-direction: row; align-items: center; }

.pmt-subtle { color: var(--muted-2); font-size: 10px; margin-top: 2px; line-height: 1.4; }

/* ---------- narrow screens ---------- */
@media (max-width: 860px) {
	.pmt-body { flex-direction: column; }
	.pmt-toolbar {
		width: auto;
		flex-direction: row;
		overflow-x: auto;
		overflow-y: hidden;
		border-right: 0;
		border-bottom: 1px solid var(--line);
	}
	.pmt-canvas-wrap { min-height: 280px; }
	.pmt-side {
		width: auto;
		max-height: 38%;
		border-left: 0;
		border-top: 1px solid var(--line);
	}
	.pmt-status { margin-left: 0; text-align: left; max-width: none; flex-basis: 100%; }
}

/* ---------- save / open dialog ---------- */
.pmt-dialog-section { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.pmt-dialog-section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.pmt-row-gap { margin-top: 10px; flex-wrap: wrap; }
.pmt-gap-top { margin-top: 14px; }
.pmt-list-name { word-break: break-word; }
.pmt-drop-card .pmt-subtle { max-width: 320px; }

/* ---------- notices ---------- */
.pmt-notice { margin: -2px 0 8px; }
