* { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); }
body {
	margin: 0 auto;
	max-width: 42rem;
	padding: 1.5rem 1.25rem 3rem;
	font-family: var(--sans);
	line-height: 1.5;
}
header a.brand {
	display: flex;
	gap: 0.6rem;
	align-items: center;
	color: inherit;
	text-decoration: none;
}
main h1 { font-family: var(--font); font-weight: 500; line-height: 1.2; overflow-wrap: anywhere; min-width: 0; }
a { color: var(--accent); }
footer {
	margin-top: 3rem;
	padding-top: 1rem;
	border-top: 1px solid var(--line);
	color: var(--muted);
	font-size: 0.9rem;
}
footer nav { display: flex; gap: 1rem; }
aside {
	padding: 0.9rem 1rem;
	border: 1px solid var(--line);
	background: var(--surface);
}
.alert {
	margin: 0 0 1rem;
	padding: 0.75rem 1rem;
	border: 1px solid var(--danger-line);
	background: var(--surface);
	color: var(--danger-line);
}
pre, code { font-family: ui-monospace, monospace; }
pre { overflow: auto; padding: 0.75rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-control); }
.providers { display: flex; flex-direction: column; align-items: flex-start; gap: 0.6rem; }
button.provider .wait { display: none; }
button.provider:disabled .ready,
button.provider[aria-disabled="true"] .ready { display: none; }
button.provider:disabled .mark,
button.provider[aria-disabled="true"] .mark { display: none; }
button.provider:disabled .wait,
button.provider[aria-disabled="true"] .wait {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}
button.provider .wait::before {
	content: "";
	width: 0.85rem;
	height: 0.85rem;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: a2a-spin 0.7s linear infinite;
}
@keyframes a2a-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
	button.provider .wait::before { animation: none; border-right-color: currentColor; }
}
button.provider {
	appearance: none;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.65rem;
	width: 100%;
	height: 44px;
	min-height: 44px;
	padding: 0.55rem 1rem;
	border: 1px solid var(--control-border);
	border-radius: var(--radius-control);
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
}
button.provider svg { width: 1.125rem; height: 1.125rem; flex: none; }
button.provider-github {
	box-sizing: border-box;
	width: 100%;
	height: 44px;
	min-height: 44px;
	padding: 0 24px;
	background: var(--accent);
	color: var(--ink);
	border-color: transparent;
}
button.provider-github:hover:not(:disabled):not([aria-disabled="true"]) { background: var(--link); color: var(--ink); }
button.provider-google { background: var(--inverse); color: var(--provider-google-ink); border-color: var(--provider-google-line); }
button.provider-google:hover:not(:disabled):not([aria-disabled="true"]) { background: var(--provider-google-hover); }
button.provider-email { background: transparent; color: var(--text); border-color: var(--control-border); }
button.provider-email:hover:not(:disabled):not([aria-disabled="true"]) { background: var(--hover-wash); color: var(--text); }
button.secondary, a.secondary {
	appearance: none;
	display: inline-block;
	background: transparent;
	color: var(--text);
	border: 1px solid var(--control-border);
	border-radius: var(--radius-control);
	padding: 0.45rem 0.8rem;
	font: inherit;
	cursor: pointer;
	text-decoration: none;
}
.who { display: flex; gap: 0.75rem; align-items: center; }
.avatar { width: 2.5rem; height: 2.5rem; border-radius: var(--radius-avatar); }
.agents { list-style: none; margin: 1rem 0; padding: 0; }
.agents li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 0; border-top: 1px solid var(--line); align-items: baseline; }
.agents .agent-name { display: flex; flex-wrap: wrap; gap: 0.35rem 0.6rem; align-items: baseline; min-width: 0; }
.agents .where { color: var(--muted); font-size: 0.82rem; }
.overview dt { color: var(--muted); }
.overview dd { margin: 0 0 0.5rem; }
.peers dt, .records dt { color: var(--muted); }
.peers dd, .records dd { margin: 0 0 0.5rem; }
.peers article, .records article { margin: 1rem 0; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.peers .actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.peers .confirm, .records .confirm, .overview .confirm { margin: var(--space-4) 0; padding: var(--space-4) var(--space-5); border: 1px solid var(--line); background: var(--bg-2); border-radius: var(--radius-control); }
.peers article > form > button.danger:not(.fill),
.records article > form > button.danger:not(.fill) {
	min-height: 44px;
}
.records .log { list-style: none; margin: 1rem 0; padding: 0; }
.records .log li { margin: 0.75rem 0; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.records .log p { margin: 0.25rem 0 0; }
.wake label { display: block; }
.wake input, .wake select { display: block; width: 100%; margin-top: 0.25rem; font: inherit; }
.wake .preview { white-space: pre-wrap; }
.token { margin: 1rem 0; }
.token .token-actions { display: flex; gap: 0.75rem; align-items: center; }
.token .token-value {
	display: block;
	flex: 1;
	min-width: 0;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	font: inherit;
	color: inherit;
}
.token .copy-token,
.token .hide-token { flex: none; width: auto; }
/* The overlay header is full-bleed. A fieldset's min-content width can shrink
   this column to the example URL. A definite minimum keeps the normal measure. */
.setup {
	box-sizing: border-box;
	width: 100%;
	min-width: 0;
	max-width: 100%;
}
.setup .steps {
	list-style: none;
	margin: 0 0 1.25rem;
	padding: 0;
}
.setup .steps > li {
	margin: 0 0 0.75rem;
	padding: 0.7rem 0.85rem;
	border: 1px solid var(--line);
	border-radius: var(--radius-control);
}
.setup .steps > li.pass,
.setup .steps > li.running { border-color: var(--accent); }
.setup .steps > li.running {
	background: color-mix(in srgb, var(--accent) 8%, var(--bg));
}
.setup .steps > li p { margin: 0.35rem 0; }
.setup .step-title {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	width: 100%;
}
.setup .step-title > span:first-child {
	min-width: 0;
}
.setup .step-title .step-spinner {
	margin-left: auto;
	flex: none;
}
.setup .step-progress {
	font-size: inherit;
}
.setup .step-spinner {
	width: 0.9rem;
	height: 0.9rem;
	flex: none;
	box-sizing: border-box;
	border: 2px solid var(--line);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: step-spin 0.7s linear infinite;
}
@keyframes step-spin { to { transform: rotate(360deg); } }
button .button-spinner {
	display: inline-block;
	width: 0.85em;
	height: 0.85em;
	margin-right: 0.45rem;
	vertical-align: -0.125em;
	box-sizing: border-box;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: step-spin 0.7s linear infinite;
}
button[aria-busy="true"],
button[aria-busy="true"]:hover,
button[aria-busy="true"]:disabled,
button[aria-busy="true"]:disabled:hover {
	opacity: 1;
	cursor: progress;
	filter: none;
	white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
	.setup .step-spinner,
	button .button-spinner { animation: none; }
	.setup .step-spinner {
		width: 0.5rem;
		height: 0.5rem;
		border: 0;
		background: var(--accent);
	}
}
.setup .advanced-names { margin: 0 0 1rem; }
.setup .advanced-names > summary { cursor: pointer; width: fit-content; }
.setup .restart { margin: 0 0 1rem; }
.setup .restart > summary {
	color: var(--accent);
	cursor: pointer;
	font-size: 0.92rem;
	width: fit-content;
}
.setup .restart[open] > summary { margin-bottom: 0.75rem; }
.setup .steps .choice-hint { display: inline; }
.setup li.ready-resource {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.2rem;
}
.setup .ready-hint {
	display: block;
	margin: 0;
	color: var(--text-soft);
	font-size: 0.95rem;
	line-height: 1.4;
}
.setup .step-progress .choice-hint { color: var(--muted); }
.setup .choices {
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
	margin: 0 0 1.25rem;
	padding: 0;
	border: 0;
	min-width: 0;
	min-inline-size: 0;
}
.setup .choices legend {
	font-weight: 600;
	padding: 0;
	margin: 0 0 0.5rem;
}
.setup .choice {
	display: flex;
	flex-direction: row;
	align-items: flex-start;
	gap: 0.75rem;
	width: 100%;
	margin: 0 0 0.5rem;
	padding: 0.7rem 0.85rem;
	border: 1px solid var(--control-border);
	border-radius: var(--radius-control);
	background: transparent;
	cursor: pointer;
}
.setup .choice:has(input:checked) {
	border-color: var(--accent);
	background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.setup .choice input[type="radio"] {
	appearance: auto;
	-webkit-appearance: radio;
	width: 1rem;
	height: 1rem;
	min-width: 1rem;
	max-width: 1rem;
	min-height: 1rem;
	max-height: 1rem;
	margin: 0.2rem 0 0;
	padding: 0;
	flex: 0 0 1rem;
	accent-color: var(--accent);
}
.setup .choice-body {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	min-width: 0;
	flex: 1;
}
.setup .choice-title { font-weight: 600; line-height: 1.3; }
.setup .choice-detail,
.setup .choice-hint,
.setup .choice-example { color: var(--muted); }
.setup .choice-detail { font-size: 0.92rem; }
.setup .choice-hint,
.setup .choice-example { font-size: 0.82rem; }
.setup .choice-example {
	font-family: ui-monospace, monospace;
	overflow-wrap: anywhere;
}
@media (max-width: 40rem) {
	.setup .choice { padding: 0.65rem 0.7rem; gap: 0.65rem; }
}
button.button.primary,
summary.button.primary,
a.button.primary {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	height: var(--control-height);
	min-height: var(--control-height);
	padding: 0 var(--space-4);
	background: var(--accent);
	color: var(--ink);
	border: 1px solid transparent;
	border-radius: var(--radius-control);
	font: 600 15px/1 var(--sans);
	font-synthesis: none;
	cursor: pointer;
	text-decoration: none;
}
header.app-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1rem;
	margin: 0 0 1.5rem;
}
header.app-header a.brand {
	display: flex;
	gap: 0.6rem;
	align-items: center;
	margin-right: auto;
	color: inherit;
	font-family: var(--font);
	font-size: 1.25rem;
	text-decoration: none;
}
header.app-header a.header-docs {
	color: var(--link);
	font-family: var(--sans);
	font-size: 15px;
	font-weight: 500;
	text-decoration: none;
}
header.app-header .app-nav {
	display: flex;
	gap: 1rem;
	align-items: center;
}
header.app-header .app-nav a,
header.app-header .account-menu a {
	display: inline;
	font-family: inherit;
	font-size: 1rem;
}
header.app-header .nav-toggle { display: none; }
header.app-header .app-nav { display: flex; }
header.app-header .photo {
	width: 2rem;
	height: 2rem;
	border-radius: var(--radius-avatar);
	background: var(--line);
	display: inline-block;
	vertical-align: middle;
}
header.app-header .account-menu { position: relative; }
header.app-header .account-button,
header.app-header .nav-toggle {
	cursor: pointer;
	list-style: none;
	background: transparent;
	border: 0;
	padding: 0;
	font: inherit;
	color: inherit;
}
header.app-header .nav-toggle::-webkit-details-marker { display: none; }
header.app-header .account-menu > div {
	position: absolute;
	right: 0;
	z-index: 2;
	min-width: 14rem;
	padding: 0.75rem 1rem;
	background: var(--bg);
	border: 1px solid var(--line);
	border-radius: var(--radius-control);
}
header.app-header .menu-label {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}
.new-agent { margin: 0 0 1rem; }
.chooser { display: flex; flex-direction: column; gap: 1rem; margin-top: 0.75rem; }
.usage { color: var(--muted); font-size: 14px; }
.agent-cards, .empty-cards { display: flex; flex-direction: column; gap: 16px; }
.agent-card, .empty-card {
	position: relative;
	width: 100%;
	padding: 20px;
	border: 1px solid var(--line);
	border-radius: var(--radius-control);
	background: var(--surface);
}
.agent-card h2, .empty-card h2 { margin: 0; font: 600 18px/1.3 var(--mono); min-width: 0; }
.card-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.card-line h2 { flex: 1 1 auto; overflow: visible; min-width: 0; }
.card-line h2 a { display: block; overflow: visible; white-space: normal; }
.host-name { display: block; overflow-wrap: anywhere; }
.host-domain { display: block; margin-top: 2px; color: var(--muted); font-size: 0.72em; font-weight: 500; overflow-wrap: anywhere; }
.agent-card h2 a::after { content: ""; position: absolute; inset: 0; }
.agent-card .button,
.agent-card .text-link,
.agent-card .copy-rows,
.agent-card form,
.agent-card .copy-row a { position: relative; z-index: 1; }
.card-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 0; color: var(--muted); font: 400 14px/1.4 var(--sans); }
.card-address { margin: 6px 0 0; color: var(--muted); font: 400 14px/1.4 var(--sans); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-rows { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; min-width: 0; }
.copy-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.copy-k { flex: 0 0 3.25rem; width: 3.25rem; color: var(--muted); font: 500 13px/1 var(--sans); }
.copy-v { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 13px/1.3 var(--mono); color: var(--text); }
.copy-keep { white-space: nowrap; }
.copy-row a { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-card:not(:has(h2 a)) .card-line > a.text-link::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.badge {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	padding: 2px var(--space-2);
	border: 0;
	border-radius: var(--radius-badge);
	background: color-mix(in srgb, var(--accent) 14%, transparent);
	color: var(--link);
	font: 500 12px/1.3 var(--sans);
	cursor: default;
}
.badge.tag,
.badge.where {
	background: var(--line);
	color: var(--tag-text);
	border: 0;
	border-radius: var(--radius-badge);
	margin: 0;
	font: 500 13px/1.3 var(--sans);
}
.badge.state-wait { background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--amber); }
.badge.state-bad { background: color-mix(in srgb, var(--danger-line) 14%, transparent); color: var(--danger-hover); }
svg[hidden] { display: none; }
.badge .dot {
	width: 6px;
	height: 6px;
	border-radius: var(--radius-avatar);
	background: currentColor;
	flex: none;
}
.card-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.host-preview { font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
button.button, a.button {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	box-sizing: border-box;
	height: var(--control-height);
	min-height: var(--control-height);
	padding: 0 var(--space-4);
	border-radius: var(--radius-control);
	font: 600 15px/1 var(--sans);
	font-synthesis: none;
	cursor: pointer;
	text-decoration: none;
}
summary.button.primary {
	width: fit-content;
	list-style: none;
}
summary.button.primary::-webkit-details-marker { display: none; }
button.danger {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	height: var(--control-height);
	min-height: var(--control-height);
	padding: 0 var(--space-4);
	background: transparent;
	color: var(--danger-line);
	border: 1px solid var(--danger-line);
	border-radius: var(--radius-control);
	font: 600 15px/1 var(--sans);
	font-synthesis: none;
	cursor: pointer;
	text-decoration: none;
}
button.danger.fill {
	background: var(--danger-fill);
	color: var(--on-danger);
	border: 1px solid var(--danger-line);
	font: 600 15px/1 var(--sans);
}
button.danger:disabled:not([aria-busy="true"]),
button.danger.fill:disabled:not([aria-busy="true"]) {
	opacity: .45;
	cursor: not-allowed;
}
button.danger.fill:disabled:not([aria-busy="true"]) {
	background: var(--danger-fill);
	color: var(--on-danger);
	-webkit-text-fill-color: var(--on-danger);
	border: 1px solid var(--danger-line);
}
.danger-zone {
	margin-top: 24px;
	padding: 16px 20px;
	border: 1px solid rgba(248, 113, 113, 0.6);
	border-radius: var(--radius-control);
}
.danger-zone > h3 { color: #f87171; margin-top: 0; }
.log-fold { margin: 0.5rem 0 1rem; }
@media (max-width: 920px) {
	header.app-header .nav-toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		min-width: 44px;
		height: 44px;
	}
	header.app-header .app-nav { display: none; }
	header.app-header .nav-menu[open] ~ .app-nav { display: flex; }
	.agent-card, .empty-card { width: 100%; }
}
@media (min-width: 921px) {
	header.app-header .nav-toggle { display: none; }
	header.app-header .nav-menu { display: none; }
	header.app-header .app-nav { display: flex; }
}
form.feedback label { display: block; font-weight: 600; }
form.feedback .feedback-help,
form.feedback .feedback-example { display: block; margin-top: 0.35rem; font-weight: 400; color: var(--muted); }
form.feedback textarea,
form.feedback input:not([type="radio"]):not([type="hidden"]),
form.feedback select { display: block; width: 100%; margin-top: 0.25rem; font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--control-border); border-radius: var(--radius-control); }
form.feedback input[type="radio"] { width: 1rem; height: 1rem; min-height: 0; margin: 0; padding: 0; accent-color: var(--accent); }
form.feedback textarea { min-height: 8rem; resize: vertical; }
form.feedback textarea.short { min-height: 6rem; }
form.feedback button.button.primary:disabled:not([aria-busy="true"]),
form.feedback button.button.primary:disabled:not([aria-busy="true"]):hover { opacity: 0.45; cursor: not-allowed; }
button[name="provider"]:disabled,
button[name="provider"]:disabled:hover,
button[name="provider"][aria-disabled="true"],
button[name="provider"][aria-disabled="true"]:hover {
	opacity: 1;
	cursor: progress;
	filter: none;
}
button.provider-github:disabled,
button.provider-github[aria-disabled="true"] {
	background: var(--accent);
	color: var(--ink);
	border-color: transparent;
}
button.provider-google:disabled,
button.provider-google[aria-disabled="true"] {
	background: var(--inverse);
	color: var(--provider-google-ink);
	border-color: var(--provider-google-line);
}
@media (max-width: 640px) {
	button.provider {
		height: var(--control-height-touch);
		min-height: var(--control-height-touch);
	}
}
