/* Site layout for kix.quest. Identity tokens and components come from /theme/theme.css. */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	background: var(--ql-bg);
}

/* A faint grid and two soft glows behind the top of every page, like a game menu's backdrop. */
body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	background:
		radial-gradient(ellipse 60% 40% at 15% 0%, rgb(255 197 61 / 0.09), transparent 70%),
		radial-gradient(ellipse 50% 40% at 90% 5%, rgb(77 163 255 / 0.08), transparent 70%), var(--ql-bg);
	color: var(--ql-text);
	font-family: var(--ql-font-body);
	font-size: 1.0625rem;
	line-height: 1.65;
	/* A stacking context, so the grid below paints above this background. */
	isolation: isolate;
}

body::before {
	content: "";
	position: fixed;
	inset: 0 0 auto;
	height: 40rem;
	z-index: -1;
	pointer-events: none;
	background-image:
		linear-gradient(rgb(255 255 255 / 0.035) 1px, transparent 1px),
		linear-gradient(90deg, rgb(255 255 255 / 0.035) 1px, transparent 1px);
	background-size: 48px 48px;
	mask-image: linear-gradient(180deg, #000, transparent);
}

main {
	flex: 1;
}

h1,
h2,
h3,
h4 {
	font-family: var(--ql-font-display);
	font-weight: 700;
	color: var(--ql-text);
	line-height: 1.05;
	letter-spacing: 0.005em;
	margin: 1.5em 0 0.5em;
}

h1 {
	font-size: clamp(2.8rem, 6vw, 4.5rem);
	text-transform: uppercase;
}

h2 {
	font-size: clamp(2rem, 3.5vw, 2.75rem);
	text-transform: uppercase;
}

h3 {
	font-size: 1.5rem;
}

h4 {
	font-size: 1.2rem;
}

a {
	color: var(--ql-link);
	text-underline-offset: 0.18em;
}

code,
pre {
	font-family: var(--ql-font-mono);
	font-size: 0.88em;
}

:not(pre) > code {
	background: var(--ql-raised);
	border: 1px solid var(--ql-rule);
	border-radius: 4px;
	padding: 0.05em 0.35em;
}

pre {
	margin: 0;
	overflow-x: auto;
	line-height: 1.55;
}

:focus-visible {
	outline: 2px solid var(--ql-accent);
	outline-offset: 2px;
}

.wrap {
	width: min(72rem, 100% - 2rem);
	margin-inline: auto;
}

.muted {
	color: var(--ql-muted);
}

.glyph {
	display: inline-block;
	width: 0.7em;
	height: 1.5em;
	vertical-align: middle;
}

.glyph.token {
	width: 1.1em;
	height: 1.1em;
}

/* Buttons: uppercase display type with clipped corners. */

.button {
	--cut: 8px;
	display: inline-block;
	font: 700 1rem/1.2 var(--ql-font-display);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--ql-text);
	background: var(--ql-raised);
	border: 0;
	clip-path: polygon(
		var(--cut) 0,
		100% 0,
		100% calc(100% - var(--cut)),
		calc(100% - var(--cut)) 100%,
		0 100%,
		0 var(--cut)
	);
	padding: 0.75em 1.4em;
	text-decoration: none;
	cursor: pointer;
	transition:
		background 120ms,
		color 120ms;
}

.button:hover {
	background: var(--ql-rule-strong);
}

/* The clip path hides an outset outline, so draw it inside, in a colour that shows on the accent too. */
.button:focus-visible {
	outline-color: var(--ql-text);
	outline-offset: -5px;
}

.button.primary {
	color: var(--ql-bg);
	background: var(--ql-accent);
}

.button.primary:hover {
	background: #ffd56e;
}

.button.quiet {
	background: rgb(255 255 255 / 0.06);
}

.button.quiet:hover {
	background: rgb(255 255 255 / 0.12);
}

/* Header and footer */

.site-header {
	position: sticky;
	top: 0;
	z-index: 10;
	background: rgb(10 12 17 / 0.8);
	backdrop-filter: blur(12px);
	border-bottom: 1px solid var(--ql-rule);
}

.nav {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 1.75rem;
	padding-block: 0.7rem;
}

.nav a {
	font-family: var(--ql-font-display);
	font-size: 1.05rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--ql-muted);
	text-decoration: none;
}

.nav a:hover {
	color: var(--ql-text);
}

.nav a.brand {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin-right: 0.5rem;
	font-size: 1.5rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	color: var(--ql-text);
}

.account {
	margin-left: auto;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem;
	font-size: 0.95rem;
}

.account form {
	margin: 0;
}

.account .button {
	font-size: 0.9rem;
	padding: 0.6em 1.1em;
}

.site-footer {
	margin-top: 3rem;
	padding-block: 2rem;
	border-top: 1px solid var(--ql-rule);
	text-align: center;
	color: var(--ql-muted);
	font-size: 0.95rem;
}

.site-footer a {
	color: var(--ql-muted);
}

/* Home */

.hero {
	display: grid;
	grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
	gap: 3.5rem;
	align-items: center;
	padding-block: 5rem 3rem;
}

.hero h1 {
	margin: 0.5rem 0 0;
}

.lede {
	font-size: 1.3rem;
	font-weight: 600;
	color: var(--ql-text);
}

.paste {
	margin-block: 1.75rem;
}

.paste-label {
	margin: 0 0 0.4rem;
	color: var(--ql-muted);
	font-size: 0.95rem;
}

.paste-box {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	background: var(--ql-panel);
	border: 1px solid var(--ql-rule);
	border-left: 2px solid var(--ql-accent);
	border-radius: 4px;
	padding: 0.6rem 0.6rem 0.6rem 1rem;
}

.paste-box code {
	flex: 1;
	background: none;
	border: 0;
	padding: 0;
	overflow-wrap: anywhere;
}

.paste-box .button {
	font-size: 0.85rem;
	padding: 0.55em 1em;
}

.actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

.hero-log {
	box-shadow: 0 30px 80px -30px rgb(0 0 0 / 0.8);
}

.log-title {
	margin: 0 0 0.75rem;
	font-size: 1.1rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--ql-muted) !important;
}

.log {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.5rem;
}

/* A log entry, edged in its size colour like an inventory slot. */
.entry {
	--ql-edge: var(--ql-rule-strong);
	display: grid;
	grid-template-columns: 1.4rem 1fr;
	column-gap: 0.5rem;
	padding: 0.65rem 0.9rem 0.65rem 0.6rem;
	background:
		linear-gradient(90deg, color-mix(in srgb, var(--ql-edge) 9%, transparent), transparent 60%), var(--ql-bg);
	border: 1px solid var(--ql-rule);
	border-left: 2px solid var(--ql-edge);
	border-radius: 4px;
}

.entry:has(.ql-xs) {
	--ql-edge: var(--ql-size-xs);
}

.entry:has(.ql-s) {
	--ql-edge: var(--ql-size-s);
}

.entry:has(.ql-m) {
	--ql-edge: var(--ql-size-m);
}

.entry:has(.ql-l) {
	--ql-edge: var(--ql-size-l);
}

.entry:has(.ql-xl) {
	--ql-edge: var(--ql-size-xl);
}

.entry-title {
	font-weight: 600;
}

.entry-meta {
	grid-column: 2;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.92rem;
}

.ql-marker {
	display: inline-flex;
	justify-content: center;
	font-size: 1.1rem;
	line-height: 1;
}

.section {
	padding-block: 3rem 1rem;
}

.section > h2 {
	margin-top: 0.35rem;
}

.intro {
	max-width: 44rem;
	margin: 0 0 2rem;
	color: var(--ql-muted);
}

.split {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 2.5rem;
	align-items: start;
}

.code-page {
	margin: 0;
}

.code-page figcaption {
	margin-bottom: 0.75rem;
	color: var(--ql-muted);
	font-family: var(--ql-font-mono);
	font-size: 0.85rem;
}

.lifecycle,
.steps {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
	gap: 1rem;
	counter-reset: step;
}

.lifecycle li,
.steps li {
	background: var(--ql-panel);
	border: 1px solid var(--ql-rule);
	border-radius: 6px;
	padding: 1.1rem 1.25rem;
}

.lifecycle p {
	margin: 0.25rem 0;
}

.state {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	font-family: var(--ql-font-display);
	font-size: 1.15rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.steps li {
	counter-increment: step;
}

.steps h3 {
	margin: 0 0 0.5rem;
}

.steps h3::before {
	content: counter(step, decimal-leading-zero);
	display: block;
	margin-bottom: 0.4rem;
	font-size: 2.25rem;
	color: var(--ql-accent);
}

.note {
	color: var(--ql-muted);
	font-size: 0.95rem;
	margin-top: 1.5rem;
}

.quest-page h4 {
	font-size: 1rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--ql-muted);
	margin: 1.25rem 0 0.25rem;
}

.quest-page p,
.quest-page ul {
	margin: 0.5rem 0;
}

.quest-head {
	display: flex;
	align-items: center;
	gap: 0.6rem;
}

.quest-head h3 {
	flex: 1;
	margin: 0;
	font-size: 1.5rem;
}

.quest-status {
	font-weight: 600;
	margin-top: 0.25rem !important;
}

/*
 * The quest map. Regions and waypoints sit left to right and wrap rather than
 * scroll; on a phone each path runs down the page instead.
 * A waypoint's colour is its size, from the theme's .ql-<size> classes.
 */

.map-regions,
.map-paths,
.trail {
	list-style: none;
	margin: 0;
	padding: 0;
}

.map-regions {
	display: flex;
	flex-wrap: wrap;
	gap: 1.25rem;
}

.region {
	flex: 1 1 auto;
	min-width: 0;
	background: var(--ql-bg);
	border: 1px solid var(--ql-rule);
	border-radius: 6px;
	padding: 1rem 1.25rem 1.25rem;
}

.region-head h3 {
	margin: 0.1rem 0 0;
	font-size: 1.6rem;
	text-transform: uppercase;
}

.region-head h3 a {
	color: var(--ql-text);
	text-decoration: none;
}

.region-head h3 a:hover {
	color: var(--ql-accent);
}

.region-count {
	font-size: 0.88rem;
}

.map-paths {
	display: grid;
	gap: 1.25rem;
	margin-top: 1rem;
}

.path-name {
	margin: 0 0 0.5rem;
	font-size: 0.88rem;
}

.path-name a {
	color: var(--ql-text);
}

.trail {
	display: flex;
	flex-wrap: wrap;
	row-gap: 1rem;
}

.waypoint {
	position: relative;
	width: 7.25rem;
}

/* The path itself: a line through each waypoint's node. */
.waypoint::before {
	content: "";
	position: absolute;
	top: 1.25rem;
	left: 0;
	right: 0;
	border-top: 2px solid var(--ql-rule);
}

.waypoint:first-child::before {
	left: 50%;
}

.waypoint:last-child::before {
	right: 50%;
}

.waypoint a {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding-inline: 0.3rem;
	text-align: center;
	text-decoration: none;
	color: inherit;
}

.waypoint-node {
	position: relative;
	flex: none;
	display: grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
}

.waypoint-node::before {
	content: "";
	position: absolute;
	inset: 0.4rem;
	transform: rotate(45deg);
	border: 2px solid currentColor;
	border-radius: 3px;
	background: color-mix(in srgb, currentColor 22%, var(--ql-bg));
	box-shadow: 0 0 12px -2px color-mix(in srgb, currentColor 55%, transparent);
}

/* Blocked waypoints are drawn dashed, unfilled, and unlit: not yet reachable. */
.waypoint-blocked .waypoint-node::before {
	border-style: dashed;
	background: var(--ql-bg);
	box-shadow: none;
}

/* A quest an agent works on wears a ring in the accent colour. */
.waypoint-agent .waypoint-node::after {
	content: "";
	position: absolute;
	inset: -0.05rem;
	border: 2px solid var(--ql-accent);
	border-radius: 50%;
}

.waypoint-agent-status {
	color: var(--ql-accent);
}

.waypoint-size {
	position: relative;
	font-family: var(--ql-font-display);
	font-size: 0.78rem;
	font-weight: 700;
}

.waypoint-text {
	display: flex;
	flex-direction: column;
	align-items: inherit;
	margin-top: 0.35rem;
	color: var(--ql-text);
}

.waypoint-title {
	font-size: 0.84rem;
	line-height: 1.3;
}

.waypoint a:hover .waypoint-title {
	color: var(--ql-accent);
	text-decoration: underline;
}

.waypoint-status {
	font-size: 0.76rem;
	font-weight: 600;
	line-height: 1.4;
}

.map-legend {
	margin-top: 1.25rem;
	font-size: 0.88rem;
}

.map-legend p {
	margin: 0.25rem 0 0;
}

.legend-sizes {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4rem;
}

.offer-amount {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-top: 0;
	font-family: var(--ql-font-display);
	font-size: 1.6rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

/* Docs */

.docs {
	padding-block: 2rem 1rem;
}

.doc-list {
	list-style: none;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
	gap: 1rem;
}

.doc-card {
	display: grid;
	gap: 0.25rem;
	height: 100%;
	text-decoration: none;
	color: var(--ql-text);
	padding-block: 1.25rem;
	transition: border-color 120ms;
}

.doc-card:hover {
	border-color: var(--ql-rule-strong);
}

.doc-title {
	font-family: var(--ql-font-display);
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--ql-text);
}

.doc-card:hover .doc-title {
	color: var(--ql-accent);
}

.doc-nav {
	display: flex;
	justify-content: space-between;
	margin-bottom: 1rem;
	font-size: 0.95rem;
}

.prose {
	max-width: 52rem;
	margin-inline: auto;
}

.prose > h1:first-child {
	margin-top: 0;
}

.prose h1 {
	font-size: clamp(2.2rem, 5vw, 3rem);
}

.prose h2 {
	font-size: 1.75rem;
}

.prose pre {
	background: var(--ql-bg);
	border: 1px solid var(--ql-rule);
	border-radius: 4px;
	padding: 0.9rem 1rem;
	margin-block: 1rem;
}

.prose table {
	border-collapse: collapse;
	margin-block: 1rem;
	display: block;
	overflow-x: auto;
}

.prose th,
.prose td {
	border: 1px solid var(--ql-rule);
	padding: 0.4rem 0.75rem;
	text-align: left;
}

.prose th {
	background: var(--ql-raised);
}

.lost {
	padding-block: 4rem;
	text-align: center;
}

/* Breadcrumbs */

.crumbs ol {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 0.5rem;
	list-style: none;
	margin: 0;
	padding: 1rem 0 0;
	font-size: 0.92rem;
	color: var(--ql-muted);
}

.crumbs li + li::before {
	content: "/";
	margin-right: 0.5rem;
	color: var(--ql-rule-strong);
}

.crumbs a {
	color: var(--ql-muted);
}

/* Board */

.board {
	display: grid;
	gap: 2rem;
	padding-block: 2.5rem 1rem;
}

.board-head h1 {
	margin: 0.25rem 0 0.5rem;
}

.board-head .lede {
	max-width: 48rem;
	margin: 0 0 1.25rem;
	font-size: 1.15rem;
	font-weight: 400;
}

.tally {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.tally a {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	min-height: 2.25rem;
	background: var(--ql-panel);
	border: 1px solid var(--ql-rule);
	border-radius: 4px;
	padding: 0.3rem 0.8rem 0.3rem 0.5rem;
	font-size: 0.95rem;
	color: inherit;
	text-decoration: none;
}

.tally li:first-child a {
	padding-left: 0.8rem;
	color: var(--ql-text);
}

.tally a:hover {
	border-color: var(--ql-rule-strong);
}

.tally a[aria-current] {
	border-color: var(--ql-accent);
	background: var(--ql-raised);
}

.milestone-head h2 a {
	color: var(--ql-text);
	text-decoration: none;
}

.milestone-head h2 a:hover {
	color: var(--ql-accent);
}

.tally .ql-marker {
	min-width: 0.9rem;
}

.as-of {
	margin: 1rem 0 0;
	font-size: 0.9rem;
}

.board h2 {
	margin: 0 0 0.25rem;
}

.board .log {
	margin-top: 1rem;
}

.milestone-summary {
	max-width: 48rem;
	margin: 0.25rem 0 1rem;
}

.progress {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 1rem;
	margin-block: 0.75rem;
}

/* An experience bar: a thin track with a lit fill. */
.progress-bar {
	flex: 1 1 14rem;
	max-width: 32rem;
	height: 0.5rem;
	background: var(--ql-raised);
	border-radius: 999px;
	overflow: hidden;
}

.progress-bar span {
	display: block;
	height: 100%;
	border-radius: inherit;
	background: linear-gradient(90deg, var(--ql-accent-dim), var(--ql-accent));
	box-shadow: 0 0 12px rgb(255 197 61 / 0.5);
}

.progress-text {
	margin: 0;
	color: var(--ql-muted);
	font-size: 0.95rem;
}

.progress-text strong {
	color: var(--ql-text);
}

a.entry-title {
	color: var(--ql-text);
	text-decoration: none;
}

a.entry-title:hover {
	color: var(--ql-accent);
	text-decoration: underline;
}

.entry-why {
	grid-column: 2;
	font-size: 0.92rem;
}

.epic {
	border-top: 1px solid var(--ql-rule);
	padding-top: 0.9rem;
	margin-top: 0.25rem;
}

.epic-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.25rem 1rem;
}

.epic-head h3 {
	margin: 0;
	font-size: 1.4rem;
}

.epic-head h3 a {
	color: var(--ql-text);
	text-decoration: none;
}

.epic-head h3 a:hover {
	color: var(--ql-accent);
}

.epic-count {
	font-size: 0.9rem;
}

.epic > .log {
	margin: 0.5rem 0 0.5rem 0.4rem;
	padding-left: 1rem;
	border-left: 1px solid var(--ql-rule);
}

.board-foot {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 2rem;
	align-items: start;
}

/* Quest page */

.quest-view {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 20rem;
	gap: 2rem;
	align-items: start;
	padding-block: 1.25rem 1rem;
}

.quest-title {
	grid-column: 1 / -1;
}

.quest-title h1 {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0.5rem 0 0.25rem;
	font-size: clamp(2.1rem, 5vw, 3rem);
}

.quest-title h1 .ql-marker:empty {
	display: none;
}

.quest-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin: 0;
	font-weight: 600;
}

.quest-page h2 {
	font-size: 1.1rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--ql-muted);
	margin: 1.75rem 0 0.5rem;
	border-bottom: 1px solid var(--ql-rule);
	padding-bottom: 0.3rem;
}

.quest-page h3 {
	font-size: 1.2rem;
	margin: 1.25rem 0 0.25rem;
}

.quest-page > h2:first-child {
	margin-top: 0;
}

.quest-body > :first-child {
	margin-top: 0;
}

.quest-body li + li {
	margin-top: 0.35rem;
}

.quest-side {
	display: grid;
	gap: 1.25rem;
}

.panel {
	padding: 1.5rem 1.25rem;
}

.panel h2 {
	margin: 0 0 0.5rem;
	font-size: 1.35rem;
	text-transform: uppercase;
}

.panel p {
	margin: 0 0 0.75rem;
}

.panel .button {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
}

.panel .button:disabled {
	cursor: not-allowed;
	opacity: 0.6;
}

.panel form {
	margin: 0;
}

.panel .paste-box {
	flex-direction: column;
	align-items: stretch;
	padding: 0.75rem;
}

.note-small {
	margin-top: 0.5rem !important;
	font-size: 0.9rem;
}

.panel-links {
	padding-top: 1rem;
	border-top: 1px solid var(--ql-rule);
	text-align: center;
	font-size: 0.95rem;
}

@media (max-width: 52rem) {
	.hero,
	.split,
	.board-foot,
	.quest-view {
		grid-template-columns: minmax(0, 1fr);
	}

	.hero {
		padding-top: 2.5rem;
	}

	/* What to do next comes before the quest's full text. */
	.quest-title {
		order: -2;
	}

	.quest-side {
		order: -1;
	}

	.ql-panel {
		padding: 1.5rem 1.25rem;
	}
}

/* On a phone the header scrolls away, and the map turns a quarter: each path runs down the page. */
@media (max-width: 40rem) {
	.site-header {
		position: static;
	}

	/* A tighter nav leaves the screen to the decision. */
	.nav {
		gap: 0.25rem 1rem;
		padding-block: 0.5rem;
	}

	.nav a {
		font-size: 0.95rem;
	}

	.nav a.brand {
		font-size: 1.25rem;
	}

	.account {
		gap: 0.5rem;
		font-size: 0.85rem;
	}

	.region {
		padding: 0.75rem 0.75rem 1rem;
	}

	.trail {
		flex-direction: column;
		row-gap: 0;
	}

	.waypoint {
		width: auto;
	}

	.waypoint a {
		flex-direction: row;
		align-items: flex-start;
		gap: 0.6rem;
		padding: 0.3rem 0;
		text-align: left;
	}

	.waypoint::before {
		top: 0;
		bottom: 0;
		left: 1.25rem;
		right: auto;
		border-top: 0;
		border-left: 2px solid var(--ql-rule);
	}

	.waypoint:first-child::before {
		top: 1.55rem;
		left: 1.25rem;
	}

	.waypoint:last-child::before {
		bottom: calc(100% - 1.55rem);
	}

	.waypoint-text {
		margin-top: 0.3rem;
	}
}

/* Project setup uses the same panels, quest rows, and theme tokens as accounts. */
.projects > section {
	margin-block: 1.5rem;
}
.project-select {
	display: grid;
	gap: 0.75rem;
	max-width: 30rem;
}
.project-select input {
	min-width: 0;
	padding: 0.65rem;
	color: var(--ql-text);
	background: var(--ql-bg);
	border: 1px solid var(--ql-rule);
	border-radius: 4px;
	font: inherit;
}
.project-select button {
	justify-self: start;
}

/* The decision inbox: one active decision thread, phone first. On a wide
   screen the agent cards sit beside the decisions; on a phone they follow them. */
.inbox {
	display: grid;
	grid-template-columns: minmax(0, 46rem);
	column-gap: 2.5rem;
	align-items: start;
}
@media (min-width: 72rem) {
	.inbox {
		grid-template-columns: minmax(0, 46rem) minmax(18rem, 1fr);
		/* Extra height from a long card list goes below the decisions. */
		grid-template-rows: auto 1fr;
	}
	.agents {
		grid-column: 2;
		grid-row: 1 / span 2;
	}
}
.inbox-main > section,
.inbox-rest > section,
.agents {
	margin-block: 1.75rem;
}
.agents > h2 {
	margin-top: 0;
}
.agent {
	display: grid;
	gap: 0.4rem;
	padding: 0.8rem 0.9rem;
	background: var(--ql-bg);
	border: 1px solid var(--ql-rule);
	border-left: 2px solid var(--ql-rule-strong);
	border-radius: 4px;
}
.agent-waiting,
.agent-limited,
.agent-offline {
	border-left-color: var(--ql-accent);
}
.agent h3 {
	margin: 0;
	font-size: 1rem;
	overflow-wrap: anywhere;
}
.agent p {
	margin: 0;
}
/* Agent text keeps its line breaks but stays escaped text. */
.agent-summary {
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}
.agent-output summary {
	cursor: pointer;
	font-size: 0.92rem;
}
.agent-output pre {
	max-height: 24rem;
	overflow: auto;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	font-size: 0.8rem;
}
.decision {
	display: grid;
	gap: 0.75rem;
	margin-block: 1rem 1.5rem;
}
.decision h2 {
	margin: 0;
	font-size: 1.5rem;
	overflow-wrap: anywhere;
}
.decision h3 {
	margin: 0 0 0.25rem;
	font-size: 1rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}
.decision p {
	margin: 0;
}
/* Agent text keeps its line breaks but stays escaped text. */
.decision .summary p,
.history p {
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}
/* Entry meta sits in a log row's second column; in the thread it spans the one column. */
.decision-meta {
	grid-column: auto;
	color: var(--ql-muted);
}
.decision-form {
	display: grid;
	gap: 1rem;
}
.decision-form button {
	justify-self: start;
}
.ask {
	display: grid;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	border: 0;
}
.ask legend {
	padding: 0;
	margin-bottom: 0.5rem;
	font-weight: 600;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}
/* Each choice is a full-width tap target. */
.choice {
	display: grid;
	grid-template-columns: 1.25rem 1fr;
	gap: 0.6rem;
	align-items: start;
	padding: 0.7rem 0.8rem;
	background: var(--ql-bg);
	border: 1px solid var(--ql-rule);
	border-radius: 4px;
	cursor: pointer;
}
.choice:has(input:checked) {
	border-color: var(--ql-accent);
}
.choice input {
	margin: 0.2rem 0 0;
	accent-color: var(--ql-accent);
}
.choice > span {
	display: grid;
	gap: 0.2rem;
	overflow-wrap: anywhere;
}
.choice-why {
	color: var(--ql-muted);
	font-size: 0.92rem;
	white-space: pre-wrap;
}
.tag {
	justify-self: start;
	padding: 0.05rem 0.4rem;
	font: 600 0.75rem/1.4 var(--ql-font-display);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--ql-bg);
	background: var(--ql-accent);
	border-radius: 2px;
}
.ask .free {
	font-size: 0.92rem;
	color: var(--ql-muted);
}
.ask textarea {
	min-width: 0;
	padding: 0.6rem;
	color: var(--ql-text);
	background: var(--ql-bg);
	border: 1px solid var(--ql-rule);
	border-radius: 4px;
	font: inherit;
	resize: vertical;
}
.decision-actions,
.project-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
}
.decision-actions form,
.project-actions form {
	margin: 0;
}
.decision-actions > p {
	flex-basis: 100%;
}
.history summary,
.skipped summary,
.new-plan summary,
.pin summary {
	cursor: pointer;
}
/* The new plan box opens under its project, across the row. */
.new-plan {
	display: block;
}
.new-plan[open] summary {
	margin-bottom: 0.75rem;
}
/* Where a new job runs is secondary, so it stays folded and small. */
/* A fieldset is as wide as its content by default; long account names must wrap, not widen the page. */
.new-plan .ask,
.pin {
	min-width: 0;
}
.pin {
	display: grid;
	gap: 0.4rem;
	font-size: 0.92rem;
	color: var(--ql-muted);
}
.pin select {
	width: 100%;
	min-width: 0;
	padding: 0.5rem;
	color: var(--ql-text);
	background: var(--ql-bg);
	border: 1px solid var(--ql-rule);
	border-radius: 4px;
	font: inherit;
}
.history ol {
	display: grid;
	gap: 0.5rem;
	padding-left: 1.25rem;
}
.entry-title[aria-current] {
	color: var(--ql-accent);
}

/* The nav's count of new decisions. */
.nav .count {
	display: inline-block;
	min-width: 1.5em;
	margin-left: 0.4em;
	padding: 0 0.35em;
	font-size: 0.85rem;
	line-height: 1.5;
	letter-spacing: 0;
	text-align: center;
	color: var(--ql-bg);
	background: var(--ql-accent);
	border-radius: 999px;
}

/* The notification switch for this device, revealed by /app.js. */
.notify {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
	align-items: center;
	margin-block: 1rem;
}
.notify[hidden],
.notify [hidden] {
	display: none;
}
.notify p {
	flex: 1 1 16rem;
	margin: 0;
}
