Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

41.4 KB
Raw Blame
/*
 * The smart-home surface.
 *
 * Everything here composes public/tokens.css primitives; the only local custom
 * properties are the ones the design system has no token for (the status hues a
 * house can be in, and the panel tints this surface shares with /materialize).
 * A house has more states than most pages ever show, so the state treatment is
 * the design: eleven of them, each with its own colour, icon and recovery text.
 */

:root {
	--hm-line: rgba(255, 255, 255, 0.09);
	--hm-line-strong: rgba(255, 255, 255, 0.16);
	--hm-panel: rgba(255, 255, 255, 0.032);
	--hm-panel-2: rgba(255, 255, 255, 0.055);
	--hm-ink-2: rgba(255, 255, 255, 0.62);
	/* 0.48, not 0.42. --hm-ink-3 is the muted ink behind nine small-text styles
	   (the eyebrow, hints, placeholders, stat labels, row meta), and every one of
	   them is under 18.66px, so WCAG AA asks 4.5:1 of all of them. At 0.42 it
	   measured 4.05:1 on the page and 4.08:1 on --hm-panel-2, which is the
	   failure axe reports as color-contrast on .hm-eyebrow. 0.48 measures 4.95:1
	   against the darkest-text case (--hm-panel-2 over the page), leaving room
	   for the tinted panels to move without dropping back under the line. */
	--hm-ink-3: rgba(255, 255, 255, 0.48);
	--hm-live: #2fbf71;
	--hm-stale: #e0a33a;
	--hm-down: #e05a4a;
	--hm-idle: rgba(255, 255, 255, 0.32);
	--hm-focus: rgba(124, 92, 255, 0.75);
}

[data-theme='light'] {
	--hm-line: rgba(0, 0, 0, 0.11);
	--hm-line-strong: rgba(0, 0, 0, 0.2);
	--hm-panel: rgba(0, 0, 0, 0.024);
	--hm-panel-2: rgba(0, 0, 0, 0.05);
	--hm-ink-2: rgba(0, 0, 0, 0.66);
	/* Light needed more headroom than dark, and it never showed up in CI: the
	   axe gate runs the page in its default dark theme, so this one was only
	   measurable by pinning data-theme. At 0.46 it read 3.40:1 on --hm-panel-2,
	   further under AA than the dark theme ever was. 0.58 measures 5.16:1. */
	--hm-ink-3: rgba(0, 0, 0, 0.58);
	--hm-idle: rgba(0, 0, 0, 0.3);
	/* The three status hues, re-cut for a white page.
	 *
	 * The dark-theme values are tuned to glow on near-black and they are text
	 * colours here as well as dot colours: .hm-tag-ok, .hm-tag-failed,
	 * .hm-tag-refused, .hm-hint[data-error], .hm-notice-icon and the step marks
	 * all take them straight as `color`. Measured on white on 2026-09-09 they
	 * read 2.38:1 (live), 2.22:1 (stale) and 3.66:1 (down) against the 4.5:1
	 * WCAG 1.4.3 asks of body text, so a light-theme user was reading the outcome
	 * of a physical action in colours that barely separate from the page.
	 *
	 * Same three signals, darkened until they clear AA on both light surfaces
	 * (--bg-0 #ffffff and --bg-1 #f3f4f6): 5.41:1, 5.92:1 and 6.54:1. They stay
	 * unmistakably green, amber and red, and where the token paints a dot or a
	 * border instead of text a deeper ink is the right call on white anyway.
	 *
	 * This was invisible to the axe gate because it runs the page in its default
	 * dark theme, which is the same reason --hm-ink-3 above drifted. The lane's
	 * own contrast spec now pins data-theme and measures both. */
	--hm-live: #0f7a43;
	--hm-stale: #8a5a05;
	--hm-down: #b3261e;
}

.hm-wrap {
	max-width: 1180px;
	margin: 0 auto;
	padding: clamp(1.25rem, 3.5vw, 2.75rem) 1.1rem 5rem;
}

/* ── Hero ────────────────────────────────────────────────────────────────── */

.hm-hero { max-width: 62ch; margin-bottom: clamp(1.25rem, 3vw, 2.25rem); }

.hm-eyebrow {
	display: inline-flex; align-items: center; gap: 0.5rem; margin: 0 0 0.8rem;
	font-size: var(--text-2xs); font-weight: var(--weight-bold);
	letter-spacing: 0.09em; text-transform: uppercase; color: var(--hm-ink-3);
}
.hm-eyebrow::before {
	content: ''; width: 6px; height: 6px; border-radius: 50%;
	background: var(--hm-live); box-shadow: 0 0 10px var(--hm-live);
}

.hm-title {
	font-family: var(--font-display);
	font-size: clamp(1.7rem, 4.4vw, 2.7rem); font-weight: 800;
	letter-spacing: -0.032em; line-height: 1.06; margin: 0 0 0.8rem;
}

.hm-lede { font-size: clamp(14px, 1.5vw, 16px); line-height: var(--leading-normal); color: var(--hm-ink-2); margin: 0; }

/* ── Panels ──────────────────────────────────────────────────────────────── */

.hm-panel {
	background: var(--hm-panel);
	border: 1px solid var(--hm-line);
	border-radius: var(--radius-lg);
	padding: clamp(1rem, 2.4vw, 1.6rem);
}

.hm-panel + .hm-panel { margin-top: var(--space-md); }

.hm-panel-head {
	display: flex; align-items: flex-start; justify-content: space-between;
	gap: var(--space-md); margin-bottom: var(--space-md);
}

.hm-panel-title { font-size: var(--text-lg); font-weight: var(--weight-semibold); margin: 0; letter-spacing: -0.015em; }
.hm-panel-sub { font-size: var(--text-md); color: var(--hm-ink-2); margin: 0.35rem 0 0; line-height: var(--leading-normal); }

/* ── Form ────────────────────────────────────────────────────────────────── */

.hm-field { display: block; margin-bottom: var(--space-md); }
.hm-label { display: block; font-size: var(--text-md); font-weight: var(--weight-medium); margin-bottom: 0.4rem; }
.hm-hint { font-size: var(--text-sm); color: var(--hm-ink-3); margin: 0.35rem 0 0; line-height: var(--leading-normal); }
/* Inline validation. The wording carries the message; the colour only agrees with it. */
.hm-hint[data-error='true'] { color: var(--hm-down); }

.hm-input {
	width: 100%; box-sizing: border-box;
	background: var(--hm-panel-2);
	border: 1px solid var(--hm-line);
	border-radius: var(--radius-md);
	color: var(--ink);
	font: inherit; font-size: var(--text-ui);
	padding: 0.7rem 0.85rem;
	transition: border-color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard);
}
.hm-input::placeholder { color: var(--hm-ink-3); }
.hm-input:hover:not(:disabled) { border-color: var(--hm-line-strong); }
.hm-input:focus-visible {
	outline: none;
	border-color: var(--hm-focus);
	box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.22);
	background: var(--hm-panel);
}
.hm-input:disabled { opacity: 0.55; cursor: not-allowed; }
.hm-input[aria-invalid='true'] { border-color: var(--hm-down); }
.hm-input[aria-invalid='true']:focus-visible { box-shadow: 0 0 0 3px rgba(224, 90, 74, 0.24); }

/* The token field carries a reveal toggle inside its own bounds, so the layout
   does not shift when the button appears. */
.hm-secret { position: relative; }
.hm-secret .hm-input { padding-inline-end: 5.2rem; }
.hm-reveal {
	position: absolute; top: 50%; inset-inline-end: 0.45rem; transform: translateY(-50%);
	background: var(--hm-panel-2); border: 1px solid var(--hm-line);
	border-radius: var(--radius-sm); color: var(--hm-ink-2);
	font: inherit; font-size: var(--text-sm); padding: 0.3rem 0.55rem;
	cursor: pointer; transition: color var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard);
}
.hm-reveal:hover { color: var(--ink); border-color: var(--hm-line-strong); }
.hm-reveal:focus-visible { outline: none; border-color: var(--hm-focus); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.22); }
.hm-reveal:active { background: var(--hm-panel); }
/*
 * A finger is not a mouse pointer. At its text size this button renders 52x31,
 * which is fine to click and too small to tap: WCAG 2.5.5 asks 44x44 of a touch
 * target, and this one sits inside the token field, where a miss puts the
 * caret in the middle of a pasted credential. Only coarse pointers pay the
 * extra height, so the desktop layout of the field is untouched.
 */
@media (pointer: coarse) {
	.hm-reveal {
		min-width: 44px;
		min-height: 44px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.hm-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
	font: inherit; font-size: var(--text-ui); font-weight: var(--weight-medium);
	padding: 0.68rem 1.1rem;
	border-radius: var(--radius-md);
	border: 1px solid var(--hm-line-strong);
	background: var(--hm-panel-2);
	color: var(--ink);
	cursor: pointer;
	/* An <a> styled as a button is a button: the browser's link underline reads as
	   a second, competing affordance inside the same control. */
	text-decoration: none;
	transition: background var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard), transform var(--duration-instant) var(--ease-standard), opacity var(--duration-fast) var(--ease-standard);
}
.hm-btn:hover:not(:disabled) { background: var(--hm-panel); border-color: var(--hm-focus); }
.hm-btn:active:not(:disabled) { transform: translateY(1px); }
.hm-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.28); border-color: var(--hm-focus); }
.hm-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.hm-btn-primary { background: var(--ink); color: var(--bg, #0b0b0f); border-color: transparent; font-weight: var(--weight-semibold); }
.hm-btn-primary:hover:not(:disabled) { background: var(--ink); opacity: 0.9; border-color: transparent; }

.hm-btn-danger { color: var(--hm-down); border-color: rgba(224, 90, 74, 0.35); }
.hm-btn-danger:hover:not(:disabled) { background: rgba(224, 90, 74, 0.1); border-color: var(--hm-down); }

.hm-btn-ghost { background: transparent; border-color: var(--hm-line); color: var(--hm-ink-2); }
.hm-btn-ghost:hover:not(:disabled) { color: var(--ink); border-color: var(--hm-line-strong); background: var(--hm-panel); }

.hm-actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center; }

/* ── Notices: the shape every failure and every explanation renders into ─── */

.hm-notice {
	display: flex; gap: 0.7rem; align-items: flex-start;
	border: 1px solid var(--hm-line);
	border-inline-start-width: 3px;
	border-radius: var(--radius-md);
	background: var(--hm-panel-2);
	padding: 0.8rem 0.95rem;
	margin: 0 0 var(--space-md);
	font-size: var(--text-md);
	line-height: var(--leading-normal);
}
.hm-notice p { margin: 0; }
.hm-notice p + p { margin-top: 0.45rem; }
.hm-notice-title { font-weight: var(--weight-semibold); }
.hm-notice-body { color: var(--hm-ink-2); }
.hm-notice ul { margin: 0.5rem 0 0; padding-inline-start: 1.1rem; color: var(--hm-ink-2); }
.hm-notice li + li { margin-top: 0.3rem; }

.hm-notice-info { border-inline-start-color: var(--hm-idle); }
.hm-notice-warn { border-inline-start-color: var(--hm-stale); }
.hm-notice-error { border-inline-start-color: var(--hm-down); }
.hm-notice-ok { border-inline-start-color: var(--hm-live); }

.hm-notice-icon { flex: 0 0 auto; width: 1.05rem; height: 1.05rem; margin-top: 0.12rem; }
.hm-notice-info .hm-notice-icon { color: var(--hm-idle); }
.hm-notice-warn .hm-notice-icon { color: var(--hm-stale); }
.hm-notice-error .hm-notice-icon { color: var(--hm-down); }
.hm-notice-ok .hm-notice-icon { color: var(--hm-live); }

/* ── Status dot, shared by the list and the detail header ────────────────── */

.hm-status { display: inline-flex; align-items: center; gap: 0.42rem; font-size: var(--text-sm); color: var(--hm-ink-2); }
.hm-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--hm-idle); flex: 0 0 auto; }
.hm-dot-connected { background: var(--hm-live); box-shadow: 0 0 8px var(--hm-live); }
.hm-dot-stale { background: var(--hm-stale); box-shadow: 0 0 8px var(--hm-stale); }
.hm-dot-unreachable,
.hm-dot-auth_failed { background: var(--hm-down); box-shadow: 0 0 8px var(--hm-down); }
.hm-dot-pending { background: var(--hm-idle); animation: hm-pulse 1.6s ease-in-out infinite; }

@keyframes hm-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* ── Verifying: named steps, never a bare spinner ────────────────────────── */

.hm-steps { list-style: none; margin: 0; padding: 0; }
.hm-step {
	display: flex; align-items: center; gap: 0.6rem;
	padding: 0.5rem 0; font-size: var(--text-md); color: var(--hm-ink-3);
	border-bottom: 1px solid var(--hm-line);
	transition: color var(--duration-base) var(--ease-standard);
}
.hm-step:last-child { border-bottom: 0; }
.hm-step[data-state='active'] { color: var(--ink); }
.hm-step[data-state='done'] { color: var(--hm-ink-2); }
.hm-step-mark {
	width: 1.05rem; height: 1.05rem; flex: 0 0 auto;
	border-radius: 50%; border: 1.5px solid currentColor;
	display: inline-flex; align-items: center; justify-content: center;
	font-size: 0.62rem;
}
.hm-step[data-state='active'] .hm-step-mark { border-color: var(--hm-live); color: var(--hm-live); animation: hm-pulse 1.4s ease-in-out infinite; }
.hm-step[data-state='done'] .hm-step-mark { border-color: var(--hm-live); color: var(--hm-live); animation: none; }

/* ── Skeletons: reserve the exact space the real content will take ───────── */

.hm-skeleton {
	background: linear-gradient(90deg, var(--hm-panel) 25%, var(--hm-panel-2) 50%, var(--hm-panel) 75%);
	background-size: 200% 100%;
	animation: hm-shimmer 1.4s ease-in-out infinite;
	border-radius: var(--radius-sm);
}
@keyframes hm-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
	.hm-skeleton, .hm-dot-pending, .hm-step[data-state='active'] .hm-step-mark { animation: none; }
	.hm-btn, .hm-input, .hm-card { transition: none; }
}

/* ── Measured summary ────────────────────────────────────────────────────── */

.hm-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
	gap: var(--space-sm);
	margin: var(--space-md) 0 0;
}
.hm-stat {
	background: var(--hm-panel-2); border: 1px solid var(--hm-line);
	border-radius: var(--radius-md); padding: 0.75rem 0.85rem;
	/* The number lands after the network call; reserving the row height stops
	   the panel from jumping when it does. */
	min-height: 4.15rem;
}
.hm-stat-value { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; letter-spacing: -0.02em; display: block; }
.hm-stat-label { font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--hm-ink-3); margin-top: 0.3rem; display: block; }

/* ── Home list ───────────────────────────────────────────────────────────── */

.hm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-sm); }

.hm-card {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: var(--space-md);
	align-items: center;
	background: var(--hm-panel-2);
	border: 1px solid var(--hm-line);
	border-radius: var(--radius-md);
	padding: 0.9rem 1rem;
	transition: border-color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard);
}
.hm-card:hover { border-color: var(--hm-line-strong); }
.hm-card:focus-within { border-color: var(--hm-focus); }

.hm-card-main { min-width: 0; }
/* A house called "aaaaaaa…" must not push the buttons off the card. */
.hm-card-label {
	font-weight: var(--weight-semibold); font-size: var(--text-ui);
	margin: 0 0 0.25rem;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hm-card-url {
	font-family: var(--font-mono); font-size: var(--text-sm); color: var(--hm-ink-3);
	margin: 0 0 0.35rem;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hm-card-actions { display: flex; gap: var(--space-xs); flex: 0 0 auto; }

/* ── Grants and log ──────────────────────────────────────────────────────── */

.hm-rows { list-style: none; margin: 0; padding: 0; }
.hm-row {
	display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-sm);
	align-items: center; padding: 0.65rem 0; border-bottom: 1px solid var(--hm-line);
}
.hm-row:last-child { border-bottom: 0; }
.hm-row-main { min-width: 0; }
.hm-row-title { font-size: var(--text-md); margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-row-meta { font-size: var(--text-sm); color: var(--hm-ink-3); margin: 0.2rem 0 0; }
.hm-mono { font-family: var(--font-mono); }

.hm-tag {
	display: inline-flex; align-items: center; gap: 0.3rem;
	font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: 0.07em;
	border: 1px solid var(--hm-line); border-radius: var(--radius-pill);
	padding: 0.15rem 0.5rem; color: var(--hm-ink-2);
}
.hm-tag-refused { color: var(--hm-down); border-color: rgba(224, 90, 74, 0.4); }
.hm-tag-failed { color: var(--hm-stale); border-color: rgba(224, 163, 58, 0.4); }
.hm-tag-ok { color: var(--hm-live); border-color: rgba(47, 191, 113, 0.4); }

/* ── Empty states ────────────────────────────────────────────────────────── */

.hm-empty { text-align: center; padding: clamp(1.5rem, 5vw, 3rem) 1rem; }
.hm-empty-art { width: 3rem; height: 3rem; margin: 0 auto var(--space-md); color: var(--hm-ink-3); opacity: 0.7; }
.hm-empty-title { font-size: var(--text-lg); font-weight: var(--weight-semibold); margin: 0 0 0.4rem; }
.hm-empty-body { font-size: var(--text-md); color: var(--hm-ink-2); margin: 0 auto var(--space-md); max-width: 44ch; line-height: var(--leading-normal); }

/* ── Utility ─────────────────────────────────────────────────────────────── */

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

.hm-ol { list-style: decimal; margin: 0.5rem 0 0; padding-inline-start: 1.2rem; color: var(--hm-ink-2); font-size: var(--text-md); line-height: var(--leading-normal); }
.hm-ol li + li { margin-top: 0.3rem; }
.hm-ol code, .hm-code {
	font-family: var(--font-mono); font-size: 0.9em;
	background: var(--hm-panel-2); border: 1px solid var(--hm-line);
	border-radius: var(--radius-sm); padding: 0.08rem 0.3rem;
}

.hm-link { color: var(--ink); text-decoration: underline; text-underline-offset: 0.18em; text-decoration-color: var(--hm-line-strong); }
.hm-link:hover { text-decoration-color: currentColor; }
.hm-link:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.28); border-radius: var(--radius-sm); }

/* ── Responsive ──────────────────────────────────────────────────────────── */

/* ── Pairing a home that only exists on a LAN (src/home/pair.js) ─────────────
   The code is the whole screen for a minute or two, so it is set at display
   scale and spaced like something meant to be read off a monitor and typed on
   a phone. Everything else on this panel is instructions, and instructions
   read better small. */

.hm-pairhost { display: block; }

.hm-paircode {
	display: flex; align-items: center; justify-content: space-between;
	gap: var(--space-md); flex-wrap: wrap;
	margin: var(--space-md) 0 0.6rem;
	padding: 1rem 1.15rem;
	border: 1px solid var(--hm-line);
	border-radius: var(--radius-lg);
	background: var(--hm-panel-2);
}

.hm-paircode-value {
	font-family: var(--font-mono);
	/* Floors at 1.25rem rather than 1.6rem: eight characters plus a separator at
	   licence-key tracking still has to fit a 320px phone without wrapping
	   mid-group, and a code broken across two lines is a code somebody types
	   wrong. */
	font-size: clamp(1.25rem, 6.5vw, 2.4rem);
	font-weight: var(--weight-bold);
	/* A pairing code is read one character at a time, so it gets the tracking a
	   licence key gets rather than the tracking prose gets. */
	letter-spacing: 0.14em;
	line-height: 1.1;
	/* Selectable in one gesture for anyone who would rather select than press
	   the copy button, including a screen reader user on a touch device. */
	user-select: all;
	word-break: break-all;
}

.hm-paircode-copy { flex: 0 0 auto; }

/* The waiting indicator is a sentence, not a heading, so the buttons under it
   need the gap a paragraph would have given them. */
.hm-live + .hm-actions { margin-top: var(--space-md); }

.hm-notice-action { margin-top: 0.7rem; }

.hm-details { margin-top: var(--space-md); }
.hm-details summary { cursor: pointer; font-size: var(--text-md); }
.hm-details summary:focus-visible { outline: 2px solid var(--hm-focus); outline-offset: 3px; border-radius: var(--radius-sm); }
.hm-details[open] summary { margin-bottom: 0.4rem; }

/* "Waiting for your home to connect", with a pulse that means a real poll is
   running. It stops when the poll stops, so it never animates over a dead
   screen. */
.hm-live {
	display: inline-flex; align-items: center; gap: 0.5rem;
	margin: 0.2rem 0 0; color: var(--hm-ink-2); font-size: var(--text-md);
}
.hm-live::before {
	content: ''; width: 7px; height: 7px; border-radius: 50%;
	background: var(--hm-live); box-shadow: 0 0 8px var(--hm-live);
	animation: hm-pulse 1.6s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
	.hm-live::before { animation: none; }
}

@media (max-width: 480px) {
	.hm-paircode { justify-content: center; text-align: center; }
	.hm-paircode-copy { width: 100%; }
}

@media (max-width: 640px) {
	.hm-card { grid-template-columns: minmax(0, 1fr); }
	.hm-card-actions { justify-content: flex-start; flex-wrap: wrap; }
	.hm-row { grid-template-columns: minmax(0, 1fr); }
	.hm-panel-head { flex-direction: column; }
	.hm-actions .hm-btn { flex: 1 1 auto; }
}

@media (max-width: 380px) {
	.hm-stats { grid-template-columns: 1fr 1fr; }
	.hm-secret .hm-input { padding-inline-end: 4.4rem; }
}

/* The "is it us or your house" verdict, appended to a failing home's status
   line once the platform's own health is known. Muted on purpose: it explains,
   it does not compete with the status it is explaining. */
.hm-status-verdict { color: var(--hm-ink-2); }

/* ── The disclosure panel ────────────────────────────────────────────────────
   What the token can do and what we keep, shown before the button that sends
   it, and what happens to a voice before the microphone opens. Rendered by
   src/home/disclosure-panel.js from the same strings the API serves.

   Styled to be read, not to be dismissed. The body sits on --hm-ink-2 rather
   than the --hm-ink-3 muted ink the hints use, and the first line (the one that
   changes somebody's mind: "anyone holding it can unlock your doors") inherits
   the page's full-contrast ink, because a promise rendered in grey is a promise
   nobody read. The left rule marks it as a distinct kind of content without
   boxing it into a callout the eye learns to skip. */
.hm-disclosure {
	margin: var(--space-md) 0 0;
	padding-inline-start: var(--space-md);
	border-inline-start: 2px solid var(--hm-line-strong);
}
.hm-disclosure-title {
	font-size: var(--text-md);
	font-weight: var(--weight-medium);
	margin: 0;
	line-height: var(--leading-snug, 1.3);
}
.hm-disclosure-list {
	list-style: none;
	margin: 0.5rem 0 0;
	padding: 0;
	color: var(--hm-ink-2);
	font-size: var(--text-sm);
	line-height: var(--leading-normal);
}
.hm-disclosure-list li + li { margin-top: 0.45rem; }
.hm-disclosure-list li:first-child { color: inherit; }
.hm-disclosure-more {
	display: inline-block;
	margin-top: 0.55rem;
	font-size: var(--text-sm);
	color: var(--hm-ink-2);
	text-decoration: underline;
	text-underline-offset: 2px;
	border-radius: 3px;
}
.hm-disclosure-more:hover { color: inherit; }
.hm-disclosure-more:focus-visible {
	outline: 2px solid var(--hm-focus);
	outline-offset: 2px;
}
@media (prefers-reduced-motion: no-preference) {
	.hm-disclosure-more { transition: color var(--duration-fast) var(--ease-standard); }
}

/* ── The privacy centre (/smart-home/privacy) ────────────────────────────────
   Everything we store about somebody's homes, with the controls to change the
   window, take a copy, or delete it. Most of the page reuses this surface's
   existing panels, stats, notices and buttons; only the pieces below are new. */

/* Breadcrumb. Small, quiet, and only ever one level: this page hangs off the
   homes list and nothing hangs off it. */
.hm-breadcrumb {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: var(--text-sm);
	color: var(--hm-ink-3);
	margin-bottom: var(--space-md);
}
.hm-breadcrumb a { color: var(--hm-ink-2); text-decoration: none; border-radius: 3px; }
.hm-breadcrumb a:hover { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.hm-breadcrumb a:focus-visible { outline: 2px solid var(--hm-focus); outline-offset: 2px; }

/* The "never stored" block. It goes ABOVE the table of what we do keep, and it
   is tinted, because it is the part somebody came to check and it should not
   read as a footnote to the list of things we hold. */
.hm-promises {
	border: 1px solid var(--hm-line);
	border-radius: var(--radius-md);
	background: var(--hm-panel);
	padding: var(--space-md);
	margin: var(--space-md) 0;
}
.hm-promises-title {
	margin: 0 0 0.5rem;
	font-size: var(--text-md);
	font-weight: var(--weight-medium);
}
.hm-promises-list {
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: var(--text-sm);
	color: var(--hm-ink-2);
	line-height: var(--leading-normal);
}
.hm-promises-list li + li { margin-top: 0.4rem; }
.hm-promises-list strong { color: inherit; font-weight: var(--weight-medium); }

/* The inventory table. Wide by nature (four columns of prose), so it scrolls
   inside its own region rather than pushing the page sideways at 320px. */
.hm-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); min-width: 42rem; }
.hm-table th {
	/* Logical, not physical: an RTL locale aligns these headers to the right
	   edge with the cells they label. */
	text-align: start;
	font-size: var(--text-2xs);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--hm-ink-3);
	font-weight: var(--weight-medium);
	padding: 0 var(--space-sm) 0.5rem 0;
	border-bottom: 1px solid var(--hm-line);
}
.hm-table td {
	padding: var(--space-sm) var(--space-sm) var(--space-sm) 0;
	border-bottom: 1px solid var(--hm-line);
	color: var(--hm-ink-2);
	vertical-align: top;
	line-height: var(--leading-normal);
}
.hm-table td:first-child { color: inherit; }
.hm-table tr:last-child td { border-bottom: 0; }
.hm-table .hm-tag { margin-inline-start: 0.4rem; vertical-align: middle; }

/* The retention control. One row per home: what it keeps now, and five windows
   as one tap each. */
.hm-retention { padding: var(--space-md) 0; border-top: 1px solid var(--hm-line); }
.hm-retention:first-of-type { border-top: 0; padding-top: var(--space-sm); }
.hm-retention-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.5rem;
}
.hm-retention-home { font-weight: var(--weight-medium); }
.hm-retention-current { font-size: var(--text-sm); color: var(--hm-ink-2); }
.hm-retention-choices { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.hm-chip {
	appearance: none;
	border: 1px solid var(--hm-line-strong);
	background: transparent;
	color: var(--hm-ink-2);
	border-radius: 999px;
	padding: 0.3rem 0.75rem;
	font: inherit;
	font-size: var(--text-sm);
	cursor: pointer;
}
.hm-chip:hover:not(:disabled) { color: inherit; border-color: currentColor; }
.hm-chip:disabled { opacity: 0.5; cursor: not-allowed; }
.hm-chip:focus-visible { outline: 2px solid var(--hm-focus); outline-offset: 2px; }
/* The current window, marked by more than colour: aria-pressed carries it for a
   screen reader, and the filled treatment carries it for everyone else. */
.hm-chip-on {
	color: inherit;
	border-color: currentColor;
	background: var(--hm-panel-2);
	font-weight: var(--weight-medium);
}
.hm-reason { margin-top: var(--space-sm); }
.hm-reason .hm-actions { margin-top: var(--space-sm); }

/* The delete panel. Tinted red at the edge only: a whole red card reads as an
   error state, and this is a control somebody deliberately came to use. */
.hm-panel-danger { border-color: rgba(224, 90, 74, 0.28); }
.hm-danger-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-sm);
	padding: var(--space-sm) 0;
	border-top: 1px solid var(--hm-line);
}
.hm-danger-row:first-of-type { border-top: 0; }
.hm-danger-row-all { border-top: 1px solid var(--hm-line-strong); margin-top: var(--space-sm); }
.hm-danger-label { font-weight: var(--weight-medium); }
/* The in-place confirm spans the row rather than sitting beside the button, so
   the question and the thing it is about stay together. */
.hm-danger-row [data-confirm] { flex-basis: 100%; }

@media (max-width: 520px) {
	.hm-danger-row { align-items: stretch; flex-direction: column; }
	.hm-danger-row .hm-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.hm-chip { transition: none; }
}

/* ── the floorplan editor (order 07) ─────────────────────────────────────────
   A top-down plan, because nobody arranges a floorplan in perspective. The 3D
   scene is the reward; this is the workspace. Every colour comes from the
   lane's variables so light and dark both work without a second palette. */

.hm-plan { display: grid; gap: var(--space-md); }

.hm-plan-toolbar {
	display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs);
	padding: var(--space-sm); border: 1px solid var(--hm-line);
	border-radius: var(--radius-md); background: var(--hm-panel);
}
.hm-plan-count { margin-inline-start: auto; font-size: var(--text-sm); color: var(--hm-ink-3); }
.hm-plan-readonly { margin: 0; font-size: var(--text-sm); color: var(--hm-ink-2); }

.hm-plan-btn {
	appearance: none; font: inherit; font-size: var(--text-sm);
	padding: 0.45rem 0.8rem; border-radius: var(--radius-sm);
	border: 1px solid var(--hm-line); background: var(--hm-panel-2); color: var(--ink);
	cursor: pointer; transition: background var(--duration-fast) var(--ease-standard), border-color var(--duration-fast) var(--ease-standard), opacity var(--duration-fast) var(--ease-standard);
	/* A thumb needs 44px even when the label does not. */
	min-height: 44px;
}
.hm-plan-btn:hover:not(:disabled) { background: var(--hm-panel); border-color: var(--hm-ink-3); }
.hm-plan-btn:active:not(:disabled) { transform: translateY(1px); }
.hm-plan-btn:focus-visible { outline: 2px solid var(--hm-live); outline-offset: 2px; }
.hm-plan-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.hm-plan-btn.is-primary { background: var(--hm-live); border-color: var(--hm-live); color: #06110b; font-weight: var(--weight-semibold); }

.hm-plan-canvas {
	position: relative; overflow: auto;
	min-height: 320px; max-height: 70vh;
	border: 1px solid var(--hm-line); border-radius: var(--radius-md);
	background:
		linear-gradient(var(--hm-line) 1px, transparent 1px) 0 0 / 16.8px 16.8px,
		linear-gradient(90deg, var(--hm-line) 1px, transparent 1px) 0 0 / 16.8px 16.8px,
		var(--hm-panel);
	padding: var(--space-sm);
}
.hm-plan-canvas:focus-visible { outline: 2px solid var(--hm-live); outline-offset: -2px; }
.hm-plan-surface { position: relative; min-width: 100%; min-height: 280px; }

.hm-plan-room {
	position: absolute; box-sizing: border-box;
	display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px;
	padding: var(--space-2xs);
	border: 1.5px solid var(--hm-ink-3); border-radius: var(--radius-sm);
	background: var(--hm-panel-2); color: var(--ink);
	cursor: grab; touch-action: none; text-align: center; overflow: hidden;
	transition: border-color var(--duration-fast) var(--ease-standard), background var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard);
}
.hm-plan-room:hover { border-color: var(--ink); }
.hm-plan-room:active { cursor: grabbing; }
.hm-plan-room:focus-visible { outline: 2px solid var(--hm-live); outline-offset: 2px; }
.hm-plan-room.is-selected { border-color: var(--hm-live); box-shadow: inset 0 0 0 1px var(--hm-live); }
.hm-plan-room.is-drop { background: color-mix(in srgb, var(--hm-live) 18%, transparent); border-color: var(--hm-live); }
/* An area deleted in Home Assistant. Shown, never silently discarded: the rest
   of somebody's plan is still their work. */
.hm-plan-room.is-orphan { border-style: dashed; opacity: 0.72; }

.hm-plan-room-name { font-size: var(--text-sm); font-weight: var(--weight-medium); line-height: 1.15; }
.hm-plan-room-size { font-size: var(--text-2xs); color: var(--hm-ink-3); font-variant-numeric: tabular-nums; }

/* A room card is drawn to scale, so its box is the room's real footprint and
   the content has to survive whatever that turns out to be. An ordinary 5.7 m
   room is 80px across at this zoom, which cannot hold a name, a measurement and
   a button: everything wrapped mid-word and clipped, and a plan of small rooms
   read as garbled text rather than as a plan. The name is what identifies the
   room, so it is the last thing to go; the measurement and the orphan tag drop
   out when there is no room for them, and the name shrinks with the box. */
.hm-plan-room { container-type: size; }
@container (max-width: 128px) or (max-height: 92px) {
	.hm-plan-room-size { display: none; }
}
@container (max-width: 96px) or (max-height: 64px) {
	.hm-plan-room-tag { display: none; }
	.hm-plan-room-name { font-size: var(--text-2xs); }
}
.hm-plan-room-tag {
	font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: 0.07em;
	color: var(--hm-ink-3);
}
.hm-plan-room-drop {
	appearance: none; font: inherit; font-size: var(--text-2xs); cursor: pointer;
	border: 1px solid var(--hm-line); border-radius: var(--radius-sm);
	background: transparent; color: var(--hm-ink-2); padding: 2px 8px; min-height: 28px;
}
.hm-plan-room-drop:hover { color: var(--ink); border-color: var(--hm-ink-3); }

.hm-plan-handle {
	/* Logical, not `right`: in an RTL locale the grab corner belongs on the end
	   of the room the reader's eye finishes at, which is the left one. */
	appearance: none; position: absolute; inset-inline-end: -1px; bottom: -1px;
	width: 22px; height: 22px; padding: 0; cursor: nwse-resize; touch-action: none;
	border: 0; border-radius: 0 0 var(--radius-sm) 0;
	background: linear-gradient(135deg, transparent 50%, var(--hm-ink-3) 50%);
}
.hm-plan-handle:focus-visible { outline: 2px solid var(--hm-live); outline-offset: 1px; }

.hm-plan-tray { border: 1px solid var(--hm-line); border-radius: var(--radius-md); background: var(--hm-panel); padding: var(--space-sm); }
.hm-plan-tray-title { font-size: var(--text-sm); font-weight: var(--weight-semibold); margin: 0 0 0.4rem; }
.hm-plan-tray-title + .hm-plan-tray-title { margin-top: var(--space-md); }
.hm-plan-tray-hint { font-size: var(--text-sm); color: var(--hm-ink-2); margin: 0 0 0.5rem; line-height: var(--leading-normal); }
.hm-plan-tray-empty { font-size: var(--text-sm); color: var(--hm-ink-3); margin: 0; }
.hm-plan-tray-rooms, .hm-plan-tray-entities { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2xs); }

.hm-plan-tray-room, .hm-plan-tray-file {
	appearance: none; font: inherit; font-size: var(--text-sm); cursor: pointer;
	min-height: 44px; padding: 0.35rem 0.7rem;
	border: 1px dashed var(--hm-ink-3); border-radius: var(--radius-sm);
	background: var(--hm-panel-2); color: var(--ink);
}
.hm-plan-tray-room:hover, .hm-plan-tray-file:hover { border-style: solid; }
.hm-plan-tray-room:focus-visible, .hm-plan-tray-file:focus-visible { outline: 2px solid var(--hm-live); outline-offset: 2px; }
.hm-plan-tray-room:disabled { opacity: 0.45; cursor: not-allowed; }

.hm-plan-tray-entity {
	display: inline-flex; align-items: center; gap: 0.4rem;
	font-size: var(--text-sm); padding: 0.25rem 0.3rem 0.25rem 0.6rem;
	border: 1px solid var(--hm-line); border-radius: var(--radius-sm);
	background: var(--hm-panel-2); cursor: grab; max-width: 100%;
}
.hm-plan-tray-entity:active { cursor: grabbing; }
.hm-plan-tray-file { min-height: 32px; padding: 0.15rem 0.5rem; font-size: var(--text-2xs); border-style: solid; }

.hm-plan-filemenu {
	display: flex; flex-wrap: wrap; gap: var(--space-2xs);
	padding: var(--space-sm); border: 1px solid var(--hm-live); border-radius: var(--radius-md);
	background: var(--hm-panel-2);
}
.hm-plan-filemenu-item {
	appearance: none; font: inherit; font-size: var(--text-sm); cursor: pointer; min-height: 44px;
	padding: 0.35rem 0.7rem; border: 1px solid var(--hm-line); border-radius: var(--radius-sm);
	background: var(--hm-panel); color: var(--ink);
}
.hm-plan-filemenu-item:focus-visible { outline: 2px solid var(--hm-live); outline-offset: 2px; }

.hm-plan-conflict {
	border: 1px solid var(--hm-warn, #d9a441); border-radius: var(--radius-md);
	background: color-mix(in srgb, var(--hm-warn, #d9a441) 10%, transparent);
	padding: var(--space-md);
}
.hm-plan-conflict h3 { margin: 0 0 0.35rem; font-size: var(--text-md); }
.hm-plan-conflict p { margin: 0 0 var(--space-sm); font-size: var(--text-sm); line-height: var(--leading-normal); }
.hm-plan-conflict-actions { display: flex; gap: var(--space-xs); flex-wrap: wrap; }

/* Making the first room. The house with no areas at all starts here, so this
   is a first-class panel rather than a dialog bolted on the side. */
.hm-plan-naming {
	display: grid; gap: var(--space-xs);
	border: 1px solid var(--hm-line); border-radius: var(--radius-md);
	background: var(--hm-panel); padding: var(--space-md);
}
.hm-plan-naming label { font-size: var(--text-sm); color: var(--hm-ink-2); }
.hm-plan-naming-input {
	width: 100%; box-sizing: border-box;
	padding: 0.45rem 0.7rem; border: 1px solid var(--hm-line); border-radius: var(--radius-sm);
	background: var(--hm-panel-2); color: var(--ink); font: inherit; font-size: var(--text-sm);
}
.hm-plan-naming-input:focus-visible { outline: 2px solid var(--hm-live); outline-offset: 1px; border-color: var(--hm-live); }
.hm-plan-naming-actions { display: flex; gap: var(--space-xs); flex-wrap: wrap; }
.hm-plan-naming-error { margin: 0; font-size: var(--text-sm); color: var(--hm-alert, #e0616a); line-height: var(--leading-normal); }

.hm-plan-tray-start {
	display: grid; gap: var(--space-xs); justify-items: start;
	margin: 0 0 var(--space-sm);
	padding: var(--space-sm); border: 1px dashed var(--hm-line); border-radius: var(--radius-sm);
}
.hm-plan-tray-start p { margin: 0; font-size: var(--text-sm); color: var(--hm-ink-2); line-height: var(--leading-normal); }

.hm-plan-skeleton { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }
.hm-plan-skeleton-room { height: 96px; border-radius: var(--radius-sm); background: var(--hm-panel-2); }

@media (prefers-reduced-motion: no-preference) {
	.hm-plan-skeleton-room { animation: hm-plan-pulse 1.6s ease-in-out infinite; }
}
@keyframes hm-plan-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 0.9; } }

@media (max-width: 640px) {
	.hm-plan-toolbar { gap: var(--space-2xs); }
	.hm-plan-count { margin-inline-start: 0; width: 100%; }
	.hm-plan-canvas { max-height: 55vh; }
	.hm-plan-skeleton { grid-template-columns: 1fr; }
}

/* ── Interactive states (QB-07) ────────────────────────────────────────────
   The file-menu items are the whole menu; they had a 44px target
   and no hover, so nothing tracked which one you were on. */

.hm-plan-filemenu-item {
	transition:
		background var(--duration-fast) var(--ease-standard),
		border-color var(--duration-fast) var(--ease-standard);
}

.hm-plan-filemenu-item:hover {
	background: var(--surface-2);
	border-color: var(--stroke-strong);
}

/*
 * The floorplan editor on a finger.
 *
 * Its toolbar buttons, its tray of rooms and the per-device File buttons all
 * render at 21px, which is comfortable with a mouse and under half of what
 * WCAG 2.5.5 asks of a touch target. The editor is also the one surface in this
 * lane somebody is most likely to use standing up with a phone in one hand:
 * they are walking round the house deciding where the rooms are.
 *
 * The rooms drawn on the canvas are deliberately NOT in this list. A room's
 * rectangle is sized by the plan, in metres, and stretching a small room to
 * 44px would draw a house that is not the house. Its resize handle is here
 * instead, because a 22px grab corner is unusable with a fingertip and it is
 * chrome rather than a measurement.
 *
 * Coarse pointers only, so a laptop's editor is untouched: a tray that grew
 * 23px per chip on a desktop would push the canvas off the screen.
 *
 * Last in the file on purpose. `.hm-plan-tray-file` sets its own `min-height:
 * 32px` several hundred lines below where this block reads best, and at equal
 * specificity the later rule wins: placed up there, this raised every control
 * except the File buttons, which stayed at 32px on a phone.
 */
@media (pointer: coarse) {
	.hm-plan-btn,
	.hm-plan-tray-room,
	.hm-plan-tray-file,
	.hm-plan-room-drop,
	.hm-plan-filemenu-item,
	.hm-plan-naming-input {
		min-height: 44px;
	}
	.hm-plan-btn,
	.hm-plan-tray-room,
	.hm-plan-tray-file,
	.hm-plan-room-drop,
	.hm-plan-filemenu-item {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: 44px;
	}
	.hm-plan-handle { width: 44px; height: 44px; }
}