/*
 * The control plane in Wheelhouse's own look (wheelhouse src/app.css): warm paper by day and
 * near-black navy at night, one gold accent for what needs you, teal for what is going well and
 * blue for work in motion. Titles are a serif with an italic gold turn, labels letter-spaced mono
 * capitals, everything else DM Sans. The fonts are served from here (static/OFL-*.txt).
 */
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 100 1000; font-display: swap; src: url(/static/dm-sans.woff2) format('woff2'); }
@font-face { font-family: 'Instrument Serif'; font-style: normal; font-weight: 400; font-display: swap; src: url(/static/instrument-serif.woff2) format('woff2'); }
@font-face { font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; font-display: swap; src: url(/static/instrument-serif-italic.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 100 800; font-display: swap; src: url(/static/jetbrains-mono.woff2) format('woff2'); }

:root {
	--radius: 0.5rem;
	--background: #f6f4ee;
	--foreground: #121a23;
	--card: #ffffff;
	--primary: #121a23;
	--primary-foreground: #ffffff;
	--muted: #ece8de;
	--muted-foreground: #5d646d;
	--border: #ddd5c4;
	--input: #cfc5b0;
	--ring: #a87412;
	--success: #16805f;
	--warning: #a87412;
	--danger: #b9442a;
	--header: #fbfaf6;
	--nav: #f3f0e8;
	--gold: #a87412;
	--teal: #13836c;
	--working: #2f6fdc;
	--on-accent: #ffffff;
	--hair: #e3dccd;
	--grid: rgb(18 26 35 / 0.035);
	--console: #0b1118;
	--font-sans: 'DM Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
	--font-title: 'Instrument Serif', Georgia, serif;
	--font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
	color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
	:root {
		--background: #0b1118;
		--foreground: #eef1f3;
		--card: #111b26;
		--primary: #eef1f3;
		--primary-foreground: #0b1118;
		--muted: #16212c;
		--muted-foreground: #8e9aa6;
		--border: #1f2b38;
		--input: #2a3847;
		--ring: #e8b04a;
		--success: #3fcf9f;
		--warning: #e8b04a;
		--danger: #f08a6c;
		--header: #0a1016;
		--nav: #0a1016;
		--gold: #e8b04a;
		--teal: #3cc6a8;
		--working: #5b9bff;
		--on-accent: #1a1203;
		--hair: #1b2633;
		--grid: rgb(255 255 255 / 0.022);
		--console: #080d13;
	}
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
	font: 16px/1.5 var(--font-sans);
	background: var(--background);
	color: var(--foreground);
	-webkit-font-smoothing: antialiased;
	/* Faint graph paper: large 48px squares. */
	background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
	background-size: 48px 48px;
	background-attachment: fixed;
}
a { color: inherit; text-underline-offset: 3px; }
p a, li a, td a, dd a, .crumbs a, .lede a, .empty a { color: var(--gold); }
h1 { font: 400 2.1rem/1.1 var(--font-title); margin: 0 0 0.5rem; letter-spacing: -0.005em; }
h1 em { font-style: italic; color: var(--gold); }
h2 { font-size: 1.15rem; font-weight: 600; margin: 0 0 0.5rem; }
h3 { font-size: 1rem; font-weight: 600; margin: 0; }
.muted { color: var(--muted-foreground); }
.small { font-size: 0.8125rem; line-height: 1.25rem; }
.mono, code { font-family: var(--font-mono); font-size: 0.86em; }
.error { color: var(--danger); }
.lede { color: var(--muted-foreground); max-width: 46rem; margin: 0 0 1.5rem; }
.lede.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.crumbs { font-size: 0.85rem; color: var(--muted-foreground); margin: 0 0 0.75rem; }
.crumbs a { text-decoration: none; color: inherit; }
.crumbs a:hover { color: var(--foreground); }

/* ---- the frame: header across the top, the menu down the left ---- */
.shell { display: grid; grid-template-columns: 16rem minmax(0, 1fr); grid-template-rows: 3.75rem minmax(0, 1fr); min-height: 100dvh; }
.shell.bare { grid-template-columns: minmax(0, 1fr); }
.top {
	grid-column: 1 / -1; position: sticky; top: 0; z-index: 30;
	display: flex; align-items: center; gap: 1rem; padding: 0 1.25rem;
	background: var(--header); border-bottom: 1px solid var(--hair);
}
.brand { display: flex; align-items: center; gap: 0.625rem; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; text-decoration: none; color: var(--foreground); }
.logo-mark {
	display: flex; width: 2.2rem; height: 2.2rem; flex-shrink: 0; align-items: center; justify-content: center; border-radius: 9999px;
	border: 1.5px solid color-mix(in srgb, var(--gold) 70%, transparent);
	background: color-mix(in srgb, var(--gold) 12%, transparent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 8%, transparent);
	color: var(--gold);
}
.who { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; color: var(--muted-foreground); text-decoration: none; font-size: 0.92rem; }
.who:hover { color: var(--foreground); }
.avatar {
	display: inline-flex; width: 2.1rem; height: 2.1rem; flex-shrink: 0; align-items: center; justify-content: center; border-radius: 9999px;
	font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; color: var(--foreground);
	border: 1px solid color-mix(in srgb, var(--hue, var(--muted-foreground)) 45%, var(--hair));
	background: color-mix(in srgb, var(--hue, var(--muted-foreground)) 18%, var(--card));
}
.avatar.sq { border-radius: 0.5rem; }
/* Six quiet chart-ink hues, so siblings read apart. */
[data-hue='0'] { --hue: #23607f; } [data-hue='1'] { --hue: #2e6a4f; } [data-hue='2'] { --hue: #a88734; }
[data-hue='3'] { --hue: #8a4b3a; } [data-hue='4'] { --hue: #5a4f86; } [data-hue='5'] { --hue: #4f6f78; }

.sidebar {
	background: var(--nav); border-right: 1px solid var(--hair); padding: 1.25rem 0.75rem;
	display: flex; flex-direction: column; gap: 0.25rem; position: sticky; top: 3.75rem; height: calc(100dvh - 3.75rem); overflow-y: auto;
}
.mono-label { font-family: var(--font-mono); font-size: 0.64rem; font-weight: 500; letter-spacing: 0.26em; text-transform: uppercase; color: var(--muted-foreground); margin: 0 0 0.5rem; }
.sidebar .mono-label { padding: 0 0.75rem; }
.nav-item {
	display: flex; min-height: 2.75rem; align-items: center; gap: 0.875rem; border-radius: var(--radius); border: 1px solid transparent;
	padding: 0.375rem 0.75rem; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
	color: color-mix(in srgb, var(--foreground) 85%, transparent); text-decoration: none;
}
.nav-item:hover { background: color-mix(in srgb, var(--muted) 70%, transparent); color: var(--foreground); }
.nav-item[aria-current] { border-color: color-mix(in srgb, var(--teal) 55%, transparent); background: color-mix(in srgb, var(--teal) 7%, transparent); color: var(--foreground); }
.nav-item svg { flex-shrink: 0; color: var(--muted-foreground); }
.nav-foot { margin-top: auto; padding-top: 0.75rem; border-top: 1px solid var(--hair); }

main { padding: 1.75rem 2.5rem 4rem; min-width: 0; max-width: 64rem; width: 100%; }
main.narrow { max-width: 40rem; }
.shell.bare main { margin: 0 auto; }

/* ---- sheets ---- */
.card, .surface { background: var(--card); border: 1px solid var(--hair); border-radius: var(--radius); }
.card { padding: 1.4rem 1.5rem; margin-bottom: 1.25rem; }
.surface + .surface { margin-top: 1rem; }
/* Sheets laid out in a grid are spaced by the grid, not stacked. */
:is(.machines, .stats, .bigchoice, .form-grid, .choices) > * { margin-top: 0 !important; }
.pad { padding: 1.1rem 1.25rem; }
.hero { padding: 2.2rem 2rem; }
.hero h1 { font-size: 2.5rem; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.page-head h1 { margin: 0 0 0.4rem; }
.page-head > .actions { margin: 0 0 1rem; }
.section-label {
	display: flex; align-items: center; gap: 0.75rem; font-family: var(--font-mono); font-size: 0.7rem; font-weight: 500;
	letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted-foreground); margin: 1.75rem 0 0.75rem;
}
.section-label::after { content: ''; min-width: 1rem; flex: 1; border-top: 1px solid var(--hair); }
.section-label.flat { margin: 0; flex: 1; }
.empty { padding: 1.25rem; color: var(--muted-foreground); }
p.empty { margin: 0; }
.empty > :first-child { margin-top: 0; }
.empty > :last-child { margin-bottom: 0; }
.empty h2 { color: var(--foreground); }
.rows > * + * { border-top: 1px solid var(--hair); }
.row { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: 0.25rem 1.5rem; padding: 0.8rem 1.25rem; }
.row > :first-child { font-weight: 500; }
.row p { margin: 0.2rem 0 0; }
.row .actions { margin-top: 0.6rem; }
.box-head, .box-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.75rem 1.25rem; border-top: 1px solid var(--hair); }

/* ---- controls (shadcn's variants, as Wheelhouse uses them) ---- */
button, .button {
	display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem; min-height: 2.25rem; padding: 0 0.8rem;
	border-radius: 0.4rem; border: 1px solid var(--border); background: var(--background); color: var(--foreground);
	font: 500 0.95rem/1 var(--font-sans); white-space: nowrap; text-decoration: none; cursor: pointer;
	box-shadow: 0 1px 2px rgb(0 0 0 / 0.05); transition: background 0.15s, border-color 0.15s;
}
button:hover, .button:hover { background: var(--muted); }
button:active, .button:active { transform: translateY(1px); }
button.primary, .button.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); box-shadow: none; }
button.primary:hover, .button.primary:hover { background: color-mix(in srgb, var(--primary) 82%, transparent); }
button.danger, .button.danger { background: color-mix(in srgb, var(--danger) 12%, transparent); border-color: transparent; color: var(--danger); box-shadow: none; }
button.danger:hover { background: color-mix(in srgb, var(--danger) 22%, transparent); }
button.ghost, .button.ghost { background: none; border-color: transparent; box-shadow: none; }
button.ghost:hover, .button.ghost:hover { background: var(--muted); }
button.link { background: none; border: none; box-shadow: none; color: var(--gold); padding: 0; min-height: 0; }
button.link:hover { text-decoration: underline; background: none; }
button.wide { width: 100%; }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
/* The option already in force: shown chosen, not greyed out. */
button[aria-pressed='true']:disabled { opacity: 1; cursor: default; }
button.busy { opacity: 0.7; cursor: progress; }
button:focus-visible, .button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .choice:focus-within {
	outline: 3px solid color-mix(in srgb, var(--ring) 50%, transparent); outline-offset: 0;
}
label { display: block; margin: 0 0 1rem; font-weight: 500; }
label .hint { display: block; font-weight: 400; font-size: 0.8125rem; line-height: 1.25rem; color: var(--muted-foreground); margin-top: 0.3rem; }
input, select, textarea {
	display: block; width: 100%; margin-top: 0.35rem; font: 400 0.95rem/1.4 var(--font-sans); padding: 0.5rem 0.75rem;
	border: 1px solid var(--border); border-radius: 0.4rem; background: var(--background); color: var(--foreground);
}
textarea { min-height: 6rem; resize: vertical; }
@media (prefers-color-scheme: dark) {
	button, .button { background: color-mix(in srgb, var(--input) 30%, transparent); border-color: var(--input); }
	button:hover, .button:hover { background: color-mix(in srgb, var(--input) 50%, transparent); }
	input, select, textarea { background: color-mix(in srgb, var(--input) 30%, transparent); border-color: var(--input); }
}
input.code { font-family: var(--font-mono); font-size: 1.3rem; letter-spacing: 0.14em; text-transform: uppercase; }
input.copy { font-size: 0.85rem; }
label.check { display: flex; align-items: center; gap: 0.5rem; }
label.check input, label.pick input, .choice input { width: auto; margin: 0; }
form { margin: 0; }
form.inline { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
form.inline input { margin: 0; flex: 1; min-width: 10rem; }
.actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0 1rem; align-items: end; }
.grid-form button { margin: 0 0 1rem; }
.code-form { max-width: 20rem; }
.footer-form { margin-top: 2rem; text-align: center; }
fieldset.picks, fieldset.choices-field { border: 0; padding: 0; margin: 0 0 1.1rem; min-width: 0; }
fieldset.picks legend, fieldset.choices-field legend { font-weight: 500; padding: 0; margin-bottom: 0.5rem; }
fieldset.picks { border: 1px solid var(--hair); border-radius: var(--radius); padding: 0.6rem 1rem 0.8rem; }
label.pick { display: flex; align-items: center; gap: 0.6rem; margin: 0.45rem 0; font-size: 1.05rem; cursor: pointer; }

/* Big radio cards: size, plan, region, machine. */
.choices { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr)); }
.choice { position: relative; display: block; margin: 0; border: 1px solid var(--hair); border-radius: var(--radius); background: var(--card); padding: 0.8rem 0.95rem; cursor: pointer; text-decoration: none; transition: border-color 0.15s, background 0.15s; }
.choice:hover { border-color: var(--border); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:has(input:checked) { border-color: color-mix(in srgb, var(--gold) 70%, transparent); background: color-mix(in srgb, var(--gold) 6%, var(--card)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 10%, transparent); }
.choice.dashed { border-style: dashed; }
.choice.soon { cursor: default; opacity: 0.6; border-style: dashed; }
.choice.soon:hover { border-color: var(--hair); }
.choice.soon .pill { font-weight: 500; }
legend .step-no { display: inline-flex; align-items: center; justify-content: center; width: 1.4rem; height: 1.4rem; margin-right: 0.5rem; border-radius: 9999px; font-size: 0.75rem; background: color-mix(in srgb, var(--gold) 14%, transparent); color: var(--gold); }
.pay-group[hidden] { display: none; }
details.more-options summary { cursor: pointer; color: var(--muted-foreground); font-size: 0.875rem; }
details.more-options[open] summary { margin-bottom: 0.6rem; }
pre.cmd { margin: 0.6rem 0; padding: 0.7rem 0.9rem; border: 1px solid var(--hair); border-radius: var(--radius); background: var(--background); overflow-x: auto; user-select: all; }
pre.cmd.request { white-space: pre-wrap; user-select: text; font-family: var(--font-mono); font-size: 0.86rem; }
ol.guide { list-style: none; padding: 0; margin: 0; counter-reset: guide; display: grid; gap: 1rem; }
ol.guide > li { counter-increment: guide; }
ol.guide h2 { margin: 0 0 0.4rem; font-size: 1.05rem; }
ol.guide h2::before { content: counter(guide) '. '; color: var(--gold); }
.choice .t { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; font-weight: 600; }
.choice .s { display: block; font-weight: 400; font-size: 0.8125rem; line-height: 1.25rem; color: var(--muted-foreground); margin-top: 0.15rem; }
.price { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 500; color: var(--gold); white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: 1.25rem; align-items: start; }
.summary { position: sticky; top: 5rem; }
.summary .big { font: 400 2.6rem/1 var(--font-title); margin: 0.4rem 0 0.75rem; }
.summary .big small { font: 400 0.85rem var(--font-sans); color: var(--muted-foreground); }

/* ---- status: words and a dot, never colour alone ---- */
.pill, .dot { display: inline-flex; align-items: center; gap: 0.35rem; border-radius: 0.25rem; padding: 0 0.45rem; font-size: 0.8125rem; line-height: 1.3rem; font-weight: 500; white-space: nowrap; }
.pill::before, .dot::before { content: ''; width: 0.4rem; height: 0.4rem; border-radius: 9999px; background: currentColor; }
.tone-good, .dot.online { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); }
.tone-work { background: color-mix(in srgb, var(--working) 12%, transparent); color: var(--working); }
.tone-warn { background: color-mix(in srgb, var(--warning) 12%, transparent); color: var(--warning); }
.tone-off, .dot { background: color-mix(in srgb, var(--muted-foreground) 14%, transparent); color: var(--muted-foreground); }
.tone-bad { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.tone-work::before { animation: blink 1.1s ease-in-out infinite; }
.sdot { width: 0.5rem; height: 0.5rem; border-radius: 9999px; flex-shrink: 0; background: var(--muted-foreground); opacity: 0.6; }
.sdot.good { background: var(--success); opacity: 1; }
.sdot.work { background: var(--working); opacity: 1; }
@keyframes blink { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .tone-work::before, .track li.now::before { animation: none; } }
.tag { display: inline-flex; border: 1px solid var(--hair); border-radius: 0.3rem; padding: 0 0.4rem; font-size: 0.75rem; line-height: 1.25rem; color: var(--muted-foreground); background: var(--background); }
.tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.4rem; }

/* ---- machines ---- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; margin-bottom: 0.25rem; }
.stat { padding: 0.8rem 1rem; }
.stat .k { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted-foreground); }
.stat .v { font: 400 1.9rem/1.15 var(--font-title); margin-top: 0.2rem; }
.stat .v small { font: 400 0.8rem var(--font-sans); color: var(--muted-foreground); margin-left: 0.3rem; }
.machines { display: grid; grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr)); gap: 1rem; }
.machine { display: flex; flex-direction: column; padding: 1.1rem 1.25rem; }
.machine-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.machine-head h2 { margin: 0; font-size: 1.15rem; }
.machine-head h2 a { text-decoration: none; }
.machine-head h2 a:hover { text-decoration: underline; }
.who-row { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.meta { display: flex; align-items: center; gap: 0.3rem; margin: 0.1rem 0 0; font-size: 0.8125rem; color: var(--muted-foreground); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem; margin: 1rem 0 0.25rem; }
.facts dt { font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted-foreground); }
.facts dd { margin: 0.1rem 0 0; overflow-wrap: anywhere; font-size: 0.92rem; }
meter.usage { display: block; width: 100%; height: 0.4rem; margin-top: 0.35rem; appearance: none; border: 0; border-radius: 9999px; background: var(--muted); }
meter.usage::-webkit-meter-bar { background: var(--muted); border: 0; border-radius: 9999px; height: 0.4rem; }
meter.usage::-webkit-meter-optimum-value { background: var(--teal); border-radius: 9999px; }
meter.usage::-webkit-meter-suboptimum-value { background: var(--gold); border-radius: 9999px; }
meter.usage::-moz-meter-bar { background: var(--teal); border-radius: 9999px; }
.on-it { margin-top: 0.9rem; padding-top: 0.75rem; border-top: 1px solid var(--hair); }
.on-it ul { list-style: none; margin: 0; padding: 0; }
.on-it li { display: flex; align-items: center; gap: 0.5rem; font-size: 0.92rem; padding: 0.15rem 0; }
.on-it li a { text-decoration: none; color: inherit; }
.on-it .role { font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted-foreground); }
.on-it p { margin: 0; }
.machine > .actions { margin-top: auto; padding-top: 1rem; }
details.more { width: 100%; }
details.more summary { cursor: pointer; color: var(--muted-foreground); font-size: 0.9rem; margin-top: 0.25rem; }
details.more form { margin-top: 0.6rem; }
.warning, .callout.warn { background: color-mix(in srgb, var(--gold) 8%, transparent); border: 1px solid color-mix(in srgb, var(--gold) 50%, transparent); border-radius: var(--radius); padding: 0.9rem 1rem; margin: 0.75rem 0 0; }
.warning p, .callout p { margin: 0.35rem 0 0; }
.callout p:first-child { margin-top: 0; }
.callout .actions { margin-top: 0.75rem; }
.notice { border-color: color-mix(in srgb, var(--gold) 60%, transparent); }
.waiting { border: 1px solid color-mix(in srgb, var(--working) 45%, transparent); background: color-mix(in srgb, var(--working) 6%, transparent); border-radius: var(--radius); padding: 0.9rem 1rem; margin: 0.75rem 0 0; }
.waiting p { margin: 0; }
.steps { padding-left: 1.2rem; }
.steps li { margin: 0.4rem 0; }
.list { list-style: none; padding: 0; margin: 0 0 1rem; }
.list li { padding: 0.75rem 0; border-bottom: 1px solid var(--hair); }
.list .actions { margin-top: 0.5rem; }

/* A machine coming up: a bar and its steps, moved along by app.js. */
.progress { margin-top: 0.9rem; }
.progress progress { display: block; width: 100%; height: 0.3rem; appearance: none; border: 0; border-radius: 9999px; background: var(--muted); overflow: hidden; }
.progress progress::-webkit-progress-bar { background: var(--muted); }
.progress progress::-webkit-progress-value { background: var(--working); transition: width 0.4s linear; }
.progress progress::-moz-progress-bar { background: var(--working); }
.progress .small { margin: 0.25rem 0 0; }
.track { list-style: none; margin: 0.6rem 0 0; padding: 0; }
.track li { display: flex; align-items: center; gap: 0.65rem; padding: 0.22rem 0; font-size: 0.92rem; color: var(--muted-foreground); }
.track li::before { content: ''; width: 1.05rem; height: 1.05rem; flex-shrink: 0; border-radius: 9999px; border: 1.5px solid var(--hair); box-sizing: border-box; }
.track li.done { color: var(--foreground); }
.track li.done::before { border-color: var(--teal); background: var(--teal) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 70% no-repeat; }
.track li.now { color: var(--foreground); font-weight: 500; }
.track li.now::before { border-color: var(--working); border-top-color: transparent; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- add a machine ---- */
.bigchoice { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; }
.bigchoice > * { display: flex; flex-direction: column; gap: 0.4rem; padding: 1.25rem 1.35rem; text-decoration: none; }
.bigchoice > a:hover { border-color: color-mix(in srgb, var(--gold) 60%, transparent); }
.bigchoice > .off { opacity: 0.65; }
.bigchoice h2, .bigchoice p { margin: 0; }
.bigchoice .ic { width: 2.4rem; height: 2.4rem; border-radius: 0.6rem; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--gold) 12%, transparent); color: var(--gold); }
.bigchoice ul { margin: 0.25rem 0 0; padding-left: 1.1rem; color: var(--muted-foreground); font-size: 0.9rem; }
.bigchoice .go { margin-top: auto; padding-top: 0.5rem; font-weight: 600; color: var(--gold); }

/* ---- mates ---- */
.mate-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.9rem; align-items: start; padding: 0.9rem 1.25rem; }
.mate-row + .mate-row { border-top: 1px solid var(--hair); }
.mate-row .title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.mate-row .charter { margin: 0.15rem 0 0.3rem; font-size: 0.95rem; }
.mate-row .where { margin: 0; font-size: 0.8125rem; color: var(--muted-foreground); }
.mate-row .where a { color: inherit; }
.mate-row .side { max-width: 12rem; text-align: right; font-size: 0.8rem; color: var(--muted-foreground); }
.fm-card > .mate-row:first-child { background: color-mix(in srgb, var(--muted) 35%, transparent); }
.badge-own, .role-chip { display: inline-flex; align-items: center; border: 1px solid var(--hair); border-radius: 0.25rem; padding: 0 0.4rem; color: var(--muted-foreground); font: 500 0.6rem/1.2rem var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; }
.who-for { font-size: 0.8rem; color: var(--muted-foreground); }
.linked-line { display: flex; align-items: center; gap: 0.45rem; margin: 0.6rem 0 0; font-size: 0.85rem; color: var(--muted-foreground); }
.linked-line a { color: inherit; }
.reach { display: grid; grid-template-columns: minmax(7rem, 0.8fr) minmax(8rem, 1fr) minmax(7rem, 0.8fr) minmax(8rem, 1fr) minmax(7rem, 0.8fr); gap: 0.6rem; align-items: center; }
.reach .node { display: grid; justify-items: center; gap: 0.3rem; min-width: 0; text-align: center; }
.reach .node .box { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border: 1px solid var(--hair); border-radius: 0.6rem; background: var(--background); color: var(--muted-foreground); }
.reach .node.hub .box { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 50%, var(--hair)); }
.reach .node strong { overflow-wrap: anywhere; }
.reach .node .sub { color: var(--muted-foreground); font-size: 0.75rem; }
.reach .wire { display: grid; justify-items: center; gap: 0.3rem; min-width: 0; text-align: center; }
.reach .wire .dir { font: 500 0.6rem var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-foreground); }
.reach .wire .line { width: 100%; border-top: 2px solid var(--hair); }
.reach .wire[data-tone="good"] .line { border-color: var(--success); }
.reach .wire[data-tone="work"] .line { border-color: var(--working); }
.reach .wire[data-tone="warn"] .line { border-color: var(--warning); }
.reach .wire .say { color: var(--muted-foreground); font-size: 0.75rem; }
.reach-note { margin: 1rem 0 0; color: var(--muted-foreground); font-size: 0.88rem; }
.comp { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.9rem; align-items: start; padding: 0.95rem 1.25rem; }
.comp + .comp { border-top: 1px solid var(--hair); }
.comp .ic { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border: 1px solid var(--hair); border-radius: 0.5rem; background: var(--background); color: var(--muted-foreground); }
.comp .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0.6rem 0 0; }
.comp .actions { margin-top: 0; }
.code-match { display: inline-flex; align-items: center; padding: 0.15rem 0.6rem; border: 1px dashed color-mix(in srgb, var(--gold) 60%, transparent); border-radius: 0.35rem; background: color-mix(in srgb, var(--gold) 6%, transparent); color: var(--gold); font: 500 1.05rem var(--font-mono); letter-spacing: 0.12em; white-space: nowrap; }

/* ---- tables ---- */
table.log { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: var(--card); border: 1px solid var(--hair); border-radius: var(--radius); overflow: hidden; }
.surface table.log, .card table.log { border: none; }
table.log th, table.log td { text-align: left; padding: 0.6rem 1rem; border-bottom: 1px solid var(--hair); vertical-align: top; }
table.log th { font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted-foreground); font-weight: 500; }
table.log tbody tr:last-child td { border-bottom: 0; }
table.log .num { text-align: right; font-variant-numeric: tabular-nums; }
table.log tfoot td { font-weight: 600; border-top: 1px solid var(--border); border-bottom: 0; }

/* ---- the installed app ---- */
.install-hint { display: flex; align-items: center; gap: 0.9rem; background: var(--card); border: 1px solid var(--hair); border-radius: var(--radius); padding: 0.9rem 1.1rem; margin-bottom: 1rem; }
.install-hint[hidden], .install-hint [hidden] { display: none; }
.install-hint img { flex-shrink: 0; border-radius: 9px; }
.install-text { flex: 1; min-width: 0; }
.install-text p { margin: 0.15rem 0 0; color: var(--muted-foreground); font-size: 0.9rem; }
.install-actions { display: flex; gap: 0.8rem; align-items: center; }
/* Installed on a phone (viewport-fit=cover): keep clear of the notch and the home indicator. */
.top { padding-left: max(1.25rem, env(safe-area-inset-left)); padding-right: max(1.25rem, env(safe-area-inset-right)); }
main { padding-bottom: max(4rem, env(safe-area-inset-bottom)); }
/* A machine in the installed app: the relayed Wheelhouse fills the screen, clear of the notch. */
body.app-frame { position: fixed; inset: 0; overflow: hidden; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); background-image: none; }
.app-frame iframe { display: block; width: 100%; height: 100%; border: 0; }

/* ---- narrow screens: the menu becomes a row under the header ---- */
@media (max-width: 900px) {
	.form-grid { grid-template-columns: 1fr; }
	.summary { position: static; }
	.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
	.shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); }
	.top { position: static; padding-top: max(0.6rem, env(safe-area-inset-top)); padding-bottom: 0.6rem; }
	.sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 0.5rem; border-right: 0; border-bottom: 1px solid var(--hair); }
	.sidebar .mono-label { display: none; }
	.nav-foot { margin: 0; padding: 0; border: 0; }
	.nav-item { min-height: 2.25rem; padding: 0.25rem 0.6rem; font-size: 0.92rem; gap: 0.5rem; }
	.who span:last-child { display: none; }
	main { padding: 1.25rem 1rem 3rem; }
	.row { grid-template-columns: minmax(0, 1fr); }
	.facts, .comp .facts { grid-template-columns: minmax(0, 1fr); }
	.machines { grid-template-columns: minmax(0, 1fr); }
	.reach { grid-template-columns: minmax(0, 1fr); }
	.reach .wire { grid-template-columns: auto minmax(2rem, 1fr); width: 100%; }
	.reach .wire .dir { justify-self: end; }
	.reach .wire .line { grid-column: 2; grid-row: 1; }
	.reach .wire .say { grid-column: 1 / -1; }
	.comp { grid-template-columns: auto minmax(0, 1fr); }
	.comp > .actions { grid-column: 1 / -1; }
	.mate-row .side { grid-column: 2 / -1; max-width: none; text-align: left; }
	table.log { display: block; overflow-x: auto; }
	.install-hint { flex-wrap: wrap; }
	.install-actions { width: 100%; justify-content: flex-end; }
}
