/* PeakTrace Online Pro. Scoped to .pto; colours and type come from the
   nucleics-chromatogram theme tokens (with fallbacks). */

.pto {
	--pto-ink: var(--ink, #373840);
	--pto-text: var(--text, #4f5054);
	--pto-line: var(--line, #dddddd);
	--pto-card: var(--card-bg, #eef1ef);
	--pto-blue: var(--nuc-dark-blue, #067bc2);
	--pto-ok: #1e7f4f;
	--pto-warn: var(--nuc-orange-deep, #c4511f);
	--pto-bad: #b3261e;
	--pto-mono: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
	color: var(--pto-text);
	max-width: 960px;
}

.pto-intro { font-size: 18px; line-height: 28px; margin-bottom: 24px; }
.pto-note, .pto-foot { font-size: 15px; line-height: 24px; }
.pto-foot { margin-top: 32px; }

/* Alerts */
.pto-alert {
	border-left: 4px solid var(--pto-bad);
	background: #fdf1f0;
	color: var(--pto-ink);
	padding: 14px 18px;
	margin-bottom: 24px;
}
.pto-alert p, .pto-alert ul { margin: 0; }
.pto-alert ul { padding-left: 20px; margin-top: 6px; }

/* Cards and step headings */
.pto-card {
	background: var(--pto-card);
	padding: 24px;
	margin-bottom: 20px;
}
.pto-step {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 16px;
	font-size: 22px;
	line-height: 28px;
	color: var(--pto-ink);
}
.pto-step-num {
	display: inline-grid;
	place-items: center;
	width: 32px;
	height: 32px;
	background: var(--pto-blue);
	color: #fff;
	font-family: var(--pto-mono);
	font-size: 15px;
}

/* File picker */
.pto-drop {
	display: grid;
	gap: 6px;
	padding: 20px;
	background: #fff;
	border: 2px dashed var(--pto-line);
	cursor: pointer;
	transition: border-color 0.15s ease;
}
.pto-drop:hover, .pto-drop:focus-within { border-color: var(--pto-blue); }
.pto-drop-title { font-weight: 600; color: var(--pto-ink); }
.pto-drop-sub, .pto-drop-files { font-size: 14px; line-height: 20px; }
.pto-drop-files { font-family: var(--pto-mono); color: var(--pto-ink); word-break: break-all; }
.pto-drop input[type="file"] { padding: 8px 0; border: 0; background: transparent; }

/* Settings */
.pto-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
	gap: 18px 24px;
	margin-bottom: 18px;
}
.pto-field label {
	display: flex;
	align-items: flex-end;
	min-height: 36px; /* two lines, so inputs in a row line up */
	font-family: var(--pto-mono);
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--pto-ink);
	margin-bottom: 6px;
}
.pto-control { display: flex; align-items: center; gap: 8px; }
.pto-control input[type="number"] { max-width: 9em; }
.pto-unit { font-size: 14px; white-space: nowrap; }
.pto-hint { font-size: 13px; line-height: 18px; margin: 6px 0 0; }

.pto-checks {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
	gap: 8px 24px;
	margin-bottom: 8px;
}
.pto-check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; line-height: 22px; }
.pto-check input { margin-top: 3px; width: 18px; height: 18px; flex: none; accent-color: var(--pto-blue); }

/* Collapsible sections: a clearly clickable bar, with the count of hidden
   settings, a "changed" badge and a Show/Hide toggle */
.pto-more { margin-top: 16px; }
.pto-more > summary {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 12px;
	list-style: none;
	cursor: pointer;
	background: #fff;
	border: 1px solid var(--pto-line);
	border-left: 4px solid var(--pto-blue);
	padding: 14px 16px;
	font-weight: 600;
	color: var(--pto-ink);
	transition: border-color 0.15s ease, background-color 0.15s ease;
}
.pto-more > summary::-webkit-details-marker { display: none; }
.pto-more > summary::marker { content: ''; }
.pto-more > summary:hover { border-color: var(--pto-blue); background: #f5f9fc; }
.pto-more > summary:focus-visible { outline: 2px solid var(--focus, var(--pto-blue)); outline-offset: 2px; }
.pto-more-title { font-size: 18px; }
.pto-more-count {
	font-family: var(--pto-mono);
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--pto-text);
}
.pto-more-changed {
	background: var(--nuc-yellow, #ecc30b);
	color: var(--pto-ink);
	font-size: 12px;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: 999px;
}
.pto-more-changed[hidden] { display: none; }
.pto-more-toggle {
	margin-left: auto;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--pto-blue);
	font-size: 15px;
}
.pto-more-toggle::after {
	content: '';
	width: 8px;
	height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg) translateY(-3px);
	transition: transform 0.2s ease;
}
.pto-more[open] .pto-more-toggle::after { transform: rotate(-135deg) translateY(-1px); }
.pto-more .pto-hide, .pto-more[open] .pto-show { display: none; }
.pto-more[open] .pto-hide { display: inline; }
.pto-more[open] > summary { border-bottom-color: transparent; }
.pto-more-body, .pto-more > dl {
	background: #fff;
	border: 1px solid var(--pto-line);
	border-top: 0;
	border-left: 4px solid var(--pto-blue);
	padding: 18px 16px 8px;
}
@media (prefers-reduced-motion: reduce) {
	.pto-more > summary, .pto-more-toggle::after { transition: none; }
}

/* Actions */
.pto-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 8px; }
.pto-actions button[disabled] { opacity: 0.6; cursor: progress; transform: none; }
.pto-busy { font-family: var(--pto-mono); font-size: 14px; color: var(--pto-blue); }

/* Results */
.pto-results-title { color: var(--pto-ink); }
.pto-table-wrap { overflow-x: auto; margin-bottom: 24px; }
.pto-results { margin-bottom: 0; min-width: 640px; }
.pto-results td { vertical-align: top; }
.pto-results .pto-num { text-align: right; padding-right: 20px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pto-file { font-family: var(--pto-mono); font-size: 14px; word-break: break-all; }
.pto-pct { font-size: 13px; color: var(--pto-text); }
.pto-call { font-weight: 600; }
.pto-call.is-ok { color: var(--pto-ok); }
.pto-call.is-flat { color: var(--pto-warn); }
.pto-call.is-bad { color: var(--pto-bad); }
.pto-download { font-weight: 600; }
.pto-download .pto-file { display: block; font-weight: 400; }
.pto-none { color: var(--pto-text); }

.pto-explain dl { margin: 0; }
.pto-explain dt { font-weight: 600; color: var(--pto-ink); margin-top: 12px; }
.pto-explain dd { margin: 2px 0 0; }

@media (max-width: 600px) {
	.pto-card { padding: 18px 16px; }
	.pto-actions .nx-btn { width: 100%; justify-content: center; }
}

/* Theme content links are underlined; buttons inside the tool are not */
.pto a.nx-btn { text-decoration: none; }
.pto-explain + .pto-note { margin-top: 20px; }

/* Sign-in panel (signed out) */
.pto-signin { border-left: 4px solid var(--pto-blue); }
.pto-signin-title, .pto-trial-title { margin: 0 0 8px; font-size: 22px; line-height: 28px; color: var(--pto-ink); }
.pto-trial-title { margin: 32px 0 12px; }
.pto-signin-form label {
	display: block;
	font-family: var(--pto-mono);
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--pto-ink);
	margin: 12px 0 6px;
}
.pto-signin-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; }
.pto-signin-row input { max-width: 16em; font-family: var(--pto-mono); letter-spacing: 0.08em; text-transform: lowercase; }

/* Account bar (signed in) */
.pto-account {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 24px;
	background: var(--pto-ink);
	color: #fff;
	padding: 14px 20px;
	margin-bottom: 24px;
}
.pto-account-info { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.pto-account-label { font-family: var(--pto-mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--nuc-light-blue, #84bcda); }
.pto-account-code { font-family: var(--pto-mono); font-size: 16px; letter-spacing: 0.08em; }
.pto-account-units { font-weight: 600; }
.pto-account-actions { display: flex; align-items: center; gap: 20px; }
.pto-account-actions form { margin: 0; }
.pto .pto-account a.nx-link { color: #fff; }
.pto-linkbtn,
.pto-linkbtn:hover {
	background: none;
	border: 0;
	padding: 0;
	color: #fff;
	font: inherit;
	text-decoration: underline;
	text-underline-offset: 4px;
	cursor: pointer;
	transform: none;
}

/* Batch progress */
.pto-bar { height: 12px; background: #fff; border: 1px solid var(--pto-line); margin: 12px 0; overflow: hidden; }
.pto-bar > span { display: block; height: 100%; background: var(--pto-blue); transition: width 0.4s ease; }
.pto-alert-units { border-left-color: var(--pto-warn); background: #fff6f1; }
@media (prefers-reduced-motion: reduce) { .pto-bar > span { transition: none; } }

/* File and folder pickers: the real inputs are visually hidden (still
   keyboard-reachable); the labels are the buttons */
.pto-visually-hidden {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
	white-space: nowrap; border: 0;
}
.pto-drop { position: relative; cursor: default; }
.pto-pick { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 4px; }
.pto .pto-pick-btn { padding: 10px 18px; font-size: 15px; background: #fff; }
.pto .pto-pick-btn:hover { background: var(--pto-ink); color: #fff; }
.pto-drop:has(#pto-traces:focus-visible) label[for="pto-traces"],
.pto-drop:has(#pto-folder:focus-visible) label[for="pto-folder"] { outline: 2px solid var(--focus, var(--pto-blue)); outline-offset: 2px; }
.pto-drop-files.is-error { color: var(--pto-bad); font-family: inherit; }
