:root {
	--bg: #f6f7f9;
	--surface: #ffffff;
	--text: #1c2330;
	--muted: #5b6678;
	--border: #d9dee7;
	--accent: #1f5fbf;
	--accent-text: #ffffff;
	--error-bg: #fdecec;
	--error-text: #8a1f1f;
	--info-bg: #e8f1fd;
	--info-text: #1b3f73;
	--green: #1f7a3d;
	--green-bg: #e6f4ea;
	--orange: #b25e09;
	--orange-bg: #fdf0df;
	--red: #b3261e;
	--red-bg: #fdecec;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #12161d;
		--surface: #1b212b;
		--text: #e6e9ef;
		--muted: #9aa5b8;
		--border: #2d3644;
		--accent: #5b9bf0;
		--accent-text: #0d1117;
		--error-bg: #3a1c1c;
		--error-text: #f4b6b6;
		--info-bg: #1b2a40;
		--info-text: #b9d3f5;
		--green: #7fd39b;
		--green-bg: #1b3326;
		--orange: #f0b36a;
		--orange-bg: #3a2c18;
		--red: #f4a29c;
		--red-bg: #3a1c1c;
	}
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	line-height: 1.5;
}

.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: 28px;
}

.login {
	max-width: 380px;
	margin: 12vh auto 0;
	padding: 0 16px;
}

.login h1 {
	margin: 0 0 4px;
	font-size: 1.25rem;
}

.login p.subtitle {
	margin: 0 0 20px;
	color: var(--muted);
	font-size: 0.9rem;
}

label {
	display: block;
	margin: 14px 0 4px;
	font-size: 0.85rem;
	color: var(--muted);
}

input[type="text"],
input[type="password"] {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--border);
	border-radius: 6px;
	background: var(--bg);
	color: var(--text);
	font: inherit;
}

input:focus {
	outline: 2px solid var(--accent);
	outline-offset: 1px;
}

button {
	margin-top: 20px;
	width: 100%;
	padding: 10px 12px;
	border: 0;
	border-radius: 6px;
	background: var(--accent);
	color: var(--accent-text);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

button.secondary {
	width: auto;
	margin: 0;
	padding: 6px 12px;
	background: transparent;
	color: var(--text);
	border: 1px solid var(--border);
	font-weight: 500;
}

/* Leave and Stop are the main actions of a running session: same size and weight as Start monitoring. */
button.action {
	width: auto;
	margin: 0;
	padding: 10px 22px;
	border: 0;
	background: var(--accent);
	color: var(--accent-text);
	font-weight: 600;
}

button.action.stop {
	background: var(--red);
	color: var(--accent-text);
}

.message {
	margin-bottom: 14px;
	padding: 10px 12px;
	border-radius: 6px;
	font-size: 0.9rem;
}

.message.error {
	background: var(--error-bg);
	color: var(--error-text);
}

.message.info {
	background: var(--info-bg);
	color: var(--info-text);
}

.hidden {
	display: none !important;
}

header.top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 24px;
	background: var(--surface);
	border-bottom: 1px solid var(--border);
}

header.top .title {
	font-weight: 600;
}

header.top .who {
	display: flex;
	align-items: center;
	gap: 12px;
	color: var(--muted);
	font-size: 0.9rem;
}

a.info-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	border: 1px solid var(--accent);
	border-radius: 6px;
	color: var(--accent);
	font-weight: 600;
	text-decoration: none;
}

a.info-link:hover {
	background: var(--info-bg);
}

.info-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	border: 1.5px solid currentColor;
	border-radius: 50%;
	font: italic 700 0.75rem Georgia, serif;
}

main {
	padding: 24px;
}

main {
	max-width: 960px;
	margin: 0 auto;
}

main h2 {
	margin: 0 0 6px;
	font-size: 1.15rem;
}

main h3 {
	margin: 28px 0 8px;
	font-size: 1rem;
}

.hint {
	margin: 0 0 14px;
	color: var(--muted);
	font-size: 0.9rem;
}

.row {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 12px;
}

.field {
	flex: 1 1 220px;
}

.field.narrow {
	flex: 0 1 180px;
}

.row button {
	width: auto;
	margin: 0;
	padding: 10px 22px;
}

select {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--border);
	border-radius: 6px;
	background: var(--bg);
	color: var(--text);
	font: inherit;
}

#serial {
	font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
	letter-spacing: 0.04em;
}

#error {
	margin: 14px 0 0;
}

.verdict {
	margin-top: 20px;
	padding: 16px 18px;
	border-radius: 10px;
	border: 1px solid var(--border);
	border-left-width: 6px;
}

.verdict.green {
	background: var(--green-bg);
	border-left-color: var(--green);
}

.verdict.orange {
	background: var(--orange-bg);
	border-left-color: var(--orange);
}

.verdict.red {
	background: var(--red-bg);
	border-left-color: var(--red);
}

.verdict-title {
	font-weight: 600;
	font-size: 1.1rem;
}

.verdict-text {
	margin-top: 4px;
	font-size: 0.95rem;
}

.meta {
	margin: 10px 2px 0;
	color: var(--muted);
	font-size: 0.85rem;
}

table.data {
	width: 100%;
	border-collapse: collapse;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 8px;
	overflow: hidden;
	font-size: 0.9rem;
}

table.data th,
table.data td {
	padding: 8px 12px;
	text-align: left;
	border-bottom: 1px solid var(--border);
	vertical-align: top;
}

table.data th {
	color: var(--muted);
	font-weight: 500;
	font-size: 0.8rem;
}

table.data tr:last-child td {
	border-bottom: 0;
}

.monitor {
	margin-top: 20px;
}

.banner {
	margin-top: 14px;
	padding: 12px 14px;
	border-radius: 8px;
	border: 1px solid var(--border);
	border-left-width: 6px;
	font-size: 0.95rem;
}

.banner.info {
	background: var(--info-bg);
	color: var(--info-text);
	border-left-color: var(--accent);
}

.banner.warn {
	background: var(--orange-bg);
	color: var(--text);
	border-left-color: var(--orange);
	font-weight: 600;
}

.banner.error {
	background: var(--error-bg);
	color: var(--error-text);
	border-left-color: var(--red);
}

#m-live {
	margin-top: 18px;
}

.live-head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 10px;
}

.live-title {
	font-weight: 600;
	font-size: 1.05rem;
}

.live-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

table.steps td.done {
	color: var(--green);
	font-weight: 600;
}

table.steps td.wait {
	color: var(--muted);
}

button:disabled,
input:disabled,
select:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.console {
	margin-top: 20px;
}

label.check {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 10px;
	color: var(--text);
	font-size: 0.9rem;
}

.console-actions {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 12px;
}

.console-actions button {
	width: auto;
	margin: 0;
	padding: 8px 18px;
}

.console-actions .hint {
	margin: 0;
}

.console-output {
	height: 360px;
	margin: 12px 0 0;
	padding: 10px 12px;
	overflow: auto;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 8px;
	font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 0.78rem;
	line-height: 1.45;
	white-space: pre-wrap;
	word-break: break-all;
}

.values {
	margin-top: 20px;
}

.values .row button {
	margin-bottom: 0;
}

#v-devices h3 {
	margin: 22px 0 4px;
}

#v-devices .device-note {
	margin: 0 0 8px;
	color: var(--muted);
	font-size: 0.85rem;
}

table.values-table td.value {
	font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
	text-align: right;
	white-space: nowrap;
}

table.values-table td.tag {
	word-break: break-all;
}

table.values-table td.age {
	color: var(--muted);
	white-space: nowrap;
}

table.values-table th.value {
	text-align: right;
}

/* The sections fold: a chevron, a title and a line that says what the section is good for. */
details.section {
	padding: 0;
}

details.section > summary {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	padding: 20px 28px;
	cursor: pointer;
	list-style: none;
	border-radius: 10px;
}

details.section > summary::-webkit-details-marker {
	display: none;
}

details.section > summary:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: -2px;
}

details.section > summary:hover .summary-title {
	color: var(--accent);
}

.chevron {
	flex: 0 0 auto;
	width: 9px;
	height: 9px;
	margin-top: 8px;
	border-right: 2px solid var(--muted);
	border-bottom: 2px solid var(--muted);
	transform: rotate(-45deg);
	transition: transform 0.15s ease;
}

details[open] > summary .chevron {
	margin-top: 5px;
	transform: rotate(45deg);
}

.summary-text {
	display: block;
}

.summary-title {
	display: block;
	font-weight: 600;
	font-size: 1.15rem;
}

.summary-desc {
	display: block;
	margin-top: 4px;
	color: var(--muted);
	font-size: 0.9rem;
	line-height: 1.45;
}

details.section > .section-body {
	padding: 6px 28px 28px;
	border-top: 1px solid var(--border);
}

#check-status {
	margin: 12px 0 0;
}

.chart {
	margin: 16px 0 8px;
	padding: 14px 16px;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: var(--bg);
}

.chart-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.chart-title {
	font-weight: 600;
	word-break: break-all;
}

.chart-plot svg {
	display: block;
	width: 100%;
	height: auto;
	margin-top: 8px;
}

.chart-plot .grid {
	stroke: var(--border);
	stroke-width: 1;
}

.chart-plot .line {
	fill: none;
	stroke: var(--accent);
	stroke-width: 2;
	stroke-linejoin: round;
}

.chart-plot .dot {
	fill: var(--accent);
}

.chart-plot text {
	fill: var(--muted);
	font-size: 11px;
	font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

table.values-table tr.selected td {
	background: var(--info-bg);
}

table.values-table button.chart-button {
	margin: 0;
	padding: 3px 10px;
	font-size: 0.8rem;
}

table.values-table td.chart-cell {
	width: 1%;
	white-space: nowrap;
}

ul.hints {
	margin: 4px 0 10px;
	padding-left: 18px;
	font-size: 0.88rem;
	line-height: 1.45;
}

ul.hints li {
	margin: 3px 0;
}

ul.hints li.warn {
	color: var(--orange);
	font-weight: 600;
}

ul.hints li.info {
	color: var(--muted);
}

.chart-summary {
	margin: 8px 0 0;
	font-size: 0.88rem;
	color: var(--text);
}

.chart-head label.chart-zero {
	margin: 0 0 0 auto;
}

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.leave-group {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.leave-group select {
	width: auto;
	padding: 6px 8px;
	font-size: 0.85rem;
}

.mine {
	margin-top: 18px;
}

.mine h3 {
	margin: 0 0 4px;
}

.mine-list {
	list-style: none;
	margin: 8px 0 0;
	padding: 0;
}

.mine-list li {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 8px 12px;
	margin-bottom: 6px;
	border: 1px solid var(--border);
	border-radius: 8px;
	font-size: 0.9rem;
}

.mine-list li.running {
	border-left: 4px solid var(--green);
}

.mine-list .detail {
	color: var(--muted);
	font-size: 0.85rem;
}

.mine-list button {
	width: auto;
	margin: 0;
	padding: 4px 12px;
	font-size: 0.85rem;
}
