/* HomeLink preview — warm paper + deep green, scoped to .house-.
 *
 * Light, airy, domestic: warm paper ground, ink text, one deep-green accent
 * kept under 10% of pixels so amber/red stay alarming. Georgia appears in
 * exactly two places (page title, property names); everything else is system
 * sans with tabular numerals. Status is never colour-alone (marker + words),
 * severity text always sits on its tinted triple at 4.5:1+, touch targets
 * floor at 44px, reduced-motion support.
 *
 * Themes: Paper (default, the vars below) and Ember (warm charcoal, in the
 * .house[data-theme="dark"] block). The switch is data-theme on the .house
 * root only — never <html>/:root, so the BoatLink demo on this host is
 * untouched. Every colour on this page flows through a var, including the
 * chart, so a theme switch repaints everything with no JS re-render.
 *
 * Desktop (min-width:1100px): fluid shell (no max-width; gutters scale via
 * clamp), auto-fill card grids at ~320-340px floors, overview fluid 12-col,
 * history chart + clamped aside. Below 1100px byte-identical single-column
 * mobile-first layout. */

.house {
	--h-paper: #FAF6ED;
	--h-panel: #FFFFFF;
	--h-raised: #F2EDE0;
	--h-hover: #F7F2E7;
	--h-line: #E3D9C3;
	--h-line-soft: #EFE8D6;
	--h-ink: #201C15;
	--h-ink-soft: #3A342A;
	--h-mut: #645B4D;
	--h-faint: #6F6656;
	--h-placeholder: #746C5D;
	--h-accent: #2E5B34;
	--h-accent-ink: #274E2C;
	--h-accent-tint: #E8F0E6;
	--h-ok-text: #2E5B34;
	--h-ok-bg: #EDF3EB;
	--h-ok-edge: #BFD6C2;
	--h-warn-text: #7C4A03;
	--h-warn-bg: #FCF0D9;
	--h-warn-edge: #D9B36A;
	--h-warn-edge-strong: #B26A00;
	--h-crit-text: #A4261C;
	--h-crit-bg: #FCEBEA;
	--h-crit-edge: #DF9A93;
	--h-crit-edge-strong: #B3261E;
	--h-info-text: #274E2C;
	--h-info-bg: #E8F0E6;
	--h-info-edge: #E3D9C3;
	--h-ctl-edge: #D8CDB6;
	--h-chart-grid: #E9E1CF;
	--h-chart-band: rgba(46, 91, 52, .10);
	--h-chart-thr: #B3261E;
	--h-chart-thr-label: #A4261C;
	--h-chart-axis: #726B5C;
	--h-chart-cross: #847662;
	--h-chart-pt-ring: #FFFFFF;
	--h-chart-tip-shadow: 0 6px 20px rgba(60, 50, 30, .14);
	--h-skel: #EFE8D8;
	--h-on-accent: #FFFFFF;
	color-scheme: light;
	max-width: 1020px;
	margin: 0 auto;
	padding: 28px 24px 96px;
	color: var(--h-ink);
	background: var(--h-paper);
	font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Ember: the dark theme. A true second palette, not an inverted filter, so
 * every severity triple is re-cut to hold 4.5:1 on both ground and panel. */
.house[data-theme="dark"] {
	--h-paper: #1C1915;
	--h-panel: #26221C;
	--h-raised: #2E2921;
	--h-hover: #2E2921;
	--h-line: #3D372C;
	--h-line-soft: #322D25;
	--h-ink: #F2EAD9;
	--h-ink-soft: #D8CFB9;
	--h-mut: #B3A893;
	--h-faint: #94897A;
	--h-placeholder: #9A9081;
	--h-accent: #8FBF7A;
	--h-accent-ink: #BFE0B4;
	--h-accent-tint: #2A3527;
	--h-ok-text: #9BD29A;
	--h-ok-bg: #223324;
	--h-ok-edge: #3D6B44;
	--h-warn-text: #F0BE5C;
	--h-warn-bg: #3A2C14;
	--h-warn-edge: #8A6420;
	--h-warn-edge-strong: #F0BE5C;
	--h-crit-text: #F19A90;
	--h-crit-bg: #3E1F1C;
	--h-crit-edge: #8E3B34;
	--h-crit-edge-strong: #F19A90;
	--h-info-text: #BFE0B4;
	--h-info-bg: #2A3527;
	--h-info-edge: #4E7A52;
	--h-ctl-edge: #4A4436;
	--h-chart-grid: #3A342A;
	--h-chart-band: rgba(143, 191, 122, .14);
	--h-chart-thr: #F19A90;
	--h-chart-thr-label: #F19A90;
	--h-chart-axis: #94897A;
	--h-chart-cross: #8D8272;
	--h-chart-pt-ring: #1C1915;
	--h-chart-tip-shadow: 0 8px 24px rgba(0, 0, 0, .6);
	--h-skel: #2E2A24;
	--h-on-accent: #1C1915;
	color-scheme: dark;
}

.house[hidden] { display: none !important; }

/* Theme-change transition. The wipe itself is drawn by the View Transitions
 * API from JS; these two rules only silence its default crossfade and give
 * browsers without the API a short crossfade instead. They fire solely while
 * our own switcher runs a transition, so the BoatLink demo is unaffected. */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.house.theme-anim, .house.theme-anim * { transition: background-color .3s ease, color .3s ease, border-color .3s ease, fill .3s ease, stroke .3s ease, box-shadow .3s ease !important; }

.house-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	margin: 8px 0 20px;
}

.house-head-text { min-width: 0; }

.house-title {
	font-family: Georgia, "Iowan Old Style", Palatino, serif;
	font-weight: 400;
	font-size: 34px;
	line-height: 40px;
	margin: 0;
	letter-spacing: -.01em;
}

.house-sub {
	color: var(--h-mut);
	font-size: 14px;
	margin: 4px 0 0;
}

.house-back {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 10px 4px;
	color: var(--h-accent-ink);
	font-size: 14px;
	white-space: nowrap;
}

/* Appearance switcher: a segmented radiogroup reusing the .house-seg shape. */
.house-theme { margin-left: auto; display: flex; flex-direction: column; gap: 4px; }
.house-theme-label {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: var(--h-faint);
}
.house-seg [role="radio"][aria-checked="true"] { background: var(--h-ink); color: var(--h-paper); font-weight: 600; }
.house-seg [role="radio"]:focus-visible { outline: 2px solid var(--h-accent); outline-offset: -2px; }

/* Verdict banner: tinted panel, words first, colour as the edge. */
.house-verdict {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	background: var(--h-ok-bg);
	border: 1px solid var(--h-ok-edge);
	border-left: 4px solid var(--h-accent);
	border-radius: 12px;
	padding: 14px 16px;
	margin: 0 0 20px;
}

.house-verdict.is-warning { background: var(--h-warn-bg); border-color: var(--h-warn-edge); border-left: 4px solid var(--h-warn-edge-strong); }
.house-verdict.is-critical { background: var(--h-crit-bg); border-color: var(--h-crit-edge); border-left: 4px solid var(--h-crit-edge-strong); }

.house-verdict-mark {
	flex: none;
	width: 22px;
	height: 22px;
	margin-top: 1px;
}

.house-verdict.is-ok .house-verdict-mark { color: var(--h-ok-text); }
.house-verdict.is-warning .house-verdict-mark { color: var(--h-warn-text); }
.house-verdict.is-critical .house-verdict-mark { color: var(--h-crit-text); }

.house-verdict-mark svg { width: 100%; height: 100%; }

.house-verdict-title {
	font-size: 19px;
	line-height: 26px;
	font-weight: 600;
	margin: 0 0 2px;
}

.house-verdict-sub {
	color: var(--h-mut);
	font-size: 14px;
	margin: 0;
}

/* Vitals: one white panel with hairline dividers, oversized numerals. */
.house-vitals {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 0;
	margin: 0 0 20px;
	background: var(--h-panel);
	border: 1px solid var(--h-line);
	border-radius: 14px;
}

.house-vital {
	padding: 14px 18px;
	border-left: 1px solid var(--h-line-soft);
}

.house-vital:first-child { border-left: none; }

.house-vital-k {
	font-size: 11.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .09em;
	color: var(--h-faint);
	margin: 0 0 4px;
}

.house-vital-v {
	font-variant-numeric: tabular-nums lining-nums;
	font-size: 30px;
	line-height: 34px;
	letter-spacing: -.01em;
}

.house-vital-v small {
	font-size: 13px;
	color: var(--h-mut);
	margin-left: 6px;
}

.house-vital-age {
	color: var(--h-faint);
	font-size: 12.5px;
	margin: 4px 0 0;
}

/* Cards */
.house-card {
	background: var(--h-panel);
	border: 1px solid var(--h-line);
	border-radius: 14px;
	padding: 20px;
	margin: 0 0 20px;
}

.house-card > h2 {
	font-size: 13px;
	line-height: 18px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: var(--h-faint);
	margin: 0 0 12px;
}

.house-card .house-empty {
	color: var(--h-mut);
	font-size: 14px;
	margin: 0 0 10px;
}

.house-card .house-empty:last-child { margin-bottom: 0; }

/* Tabs */
.house-tabs {
	display: flex;
	gap: 4px;
	border-bottom: 1px solid var(--h-line);
	margin: 4px 0 20px;
	overflow-x: auto;
}

.house-tabs button {
	background: none;
	border: none;
	border-bottom: 2px solid transparent;
	color: var(--h-mut);
	font-size: 15px;
	font-weight: 500;
	padding: 11px 14px;
	min-height: 44px;
	margin-bottom: -1px;
	cursor: pointer;
	white-space: nowrap;
}

.house-tabs button[aria-selected="true"] {
	color: var(--h-ink);
	font-weight: 600;
	border-bottom: 2px solid var(--h-accent);
}

.house-tabs button:hover { color: var(--h-ink); }

/* Rooms are sections, not cards-in-cards. */
.house-room-name {
	font-size: 13px;
	line-height: 18px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: var(--h-ink);
	margin: 0 0 4px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.house-room-dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	flex: none;
	background: var(--h-accent);
}

.house-room-dot.is-ok { background: var(--h-accent); }
.house-room-dot.is-warning { background: var(--h-warn-edge-strong); }
.house-room-dot.is-critical { background: var(--h-crit-edge-strong); }
.house-room-dot.is-quiet { background: var(--h-accent); }

.house-dev {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 2px;
	font-size: 14.5px;
	line-height: 21px;
	border-top: 1px solid var(--h-line-soft);
}

.house-dev:first-of-type { border-top: none; }
/* Rows carrying controls (Hide buttons, move picker) centre on the 44px
 * control instead of sitting text on the baseline. */
.house-dev:has(.house-btn, .house-mini, select, button) { align-items: center; }

.house-dev-name { color: var(--h-ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.house-dev-name .house-tag {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .05em;
	border: 1px solid var(--h-line);
	border-radius: 999px;
	padding: 2px 9px;
	margin-left: 8px;
	color: var(--h-mut);
	white-space: nowrap;
}

.house-dev-val {
	font-variant-numeric: tabular-nums lining-nums;
	white-space: nowrap;
	color: var(--h-ink);
}

.house-dev-val small { color: var(--h-faint); font-size: 12px; margin-left: 3px; }
.house-dev-val.is-stale { color: var(--h-faint); }
.house-dev-val.is-warning { color: var(--h-warn-text); font-weight: 600; }
.house-dev-val.is-critical { color: var(--h-crit-text); font-weight: 700; }

/* History */
.house-hist-ctl {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	margin-bottom: 12px;
}

.house-seg { display: inline-flex; background: var(--h-panel); border: 1px solid var(--h-line); border-radius: 10px; overflow: hidden; }
.house-seg button {
	background: none;
	border: none;
	color: var(--h-mut);
	font-size: 13px;
	font-weight: 500;
	padding: 8px 13px;
	min-height: 44px;
	cursor: pointer;
	font-variant-numeric: tabular-nums;
	font-family: inherit;
}
.house-seg button + button { border-left: 1px solid var(--h-line); }
.house-seg button[aria-pressed="true"] { background: var(--h-ink); color: var(--h-paper); font-weight: 600; }

/* Visible label for the history measure picker. */
.house-hist-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--h-mut); }

.house-hist-ctl select {
	background: var(--h-panel);
	color: var(--h-ink);
	border: 1px solid var(--h-line);
	border-radius: 9px;
	font-size: 13.5px;
	padding: 8px 10px;
	max-width: 220px;
	min-height: 44px;
}

.house-pg {
	margin-left: auto;
	display: inline-flex;
	gap: 8px;
}

.house-btn {
	background: var(--h-panel);
	border: 1px solid var(--h-ctl-edge);
	border-radius: 9px;
	color: var(--h-ink);
	font-size: 13.5px;
	font-weight: 500;
	padding: 8px 13px;
	min-height: 44px;
	cursor: pointer;
	font-family: inherit;
}
.house-btn:hover { border-color: var(--h-accent); color: var(--h-accent-ink); }
.house-btn:disabled { opacity: .45; cursor: default; }
.house-btn:disabled:hover { border-color: var(--h-ctl-edge); color: var(--h-ink); }
.house-btn.house-live { border-color: var(--h-accent); color: var(--h-accent-ink); background: var(--h-accent-tint); }
.house-btn.is-primary { background: var(--h-accent); border-color: transparent; color: var(--h-on-accent); font-weight: 700; }
.house-btn.is-primary:hover { color: var(--h-on-accent); border-color: transparent; }

.house-chart { position: relative; }

.house-chart svg { display: block; width: 100%; height: auto; }

.house-chart .h-grid { stroke: var(--h-chart-grid); stroke-width: 1; }
.house-chart .h-band { fill: var(--h-chart-band); }
.house-chart .h-avg { fill: none; stroke: var(--h-accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.house-chart .h-thr { stroke: var(--h-chart-thr); stroke-width: 1.2; stroke-dasharray: 5 4; }
.house-chart .h-axis { fill: var(--h-chart-axis); font-size: 11px; font-variant-numeric: tabular-nums; }
.house-chart .h-thr-label { fill: var(--h-chart-thr-label); font-weight: 700; }
.house-chart .h-cross { stroke: var(--h-chart-cross); stroke-width: 1; }
.house-chart .h-pt { fill: var(--h-accent); stroke: var(--h-chart-pt-ring); stroke-width: 2; }

.house-tip {
	position: absolute;
	pointer-events: none;
	background: var(--h-panel);
	border: 1px solid var(--h-line);
	border-radius: 9px;
	box-shadow: var(--h-chart-tip-shadow);
	padding: 8px 10px;
	font-size: 12.5px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	z-index: 2;
	color: var(--h-ink);
}

.house-tip .h-t { color: var(--h-faint); font-size: 11.5px; }

.house-chart-status {
	color: var(--h-mut);
	font-size: 14px;
	padding: 28px 8px;
	text-align: center;
	margin: 0;
}

.house-skel {
	border-radius: 10px;
	background: var(--h-skel);
	min-height: 200px;
	margin: 0;
	animation: house-pulse 1.6s ease-in-out infinite;
}
/* The chart slot never moves: skeleton and status reserve the same 260px
 * the rendered SVG takes at every width. */
.house-chart .house-skel { min-height: 260px; }
.house-chart-status {
	min-height: 260px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 8px;
}

@keyframes house-pulse { 50% { opacity: .55; } }

/* Analysis */
.house-an { display: grid; gap: 12px; }
.house-an-row {
	background: var(--h-panel);
	border: 1px solid var(--h-line);
	border-left: 3px solid var(--h-accent);
	border-radius: 10px;
	padding: 12px 14px;
	font-size: 14px;
}
.house-an-row.is-warning { border-left-color: var(--h-warn-edge-strong); }
.house-an-row.is-critical { border-left-color: var(--h-crit-edge-strong); }
.house-an-row.is-ok { border-left-color: var(--h-accent); }
.house-an-row h3 { font-size: 14.5px; margin: 0 0 4px; font-weight: 600; color: var(--h-ink); }
.house-an-row h3 .house-num {
	font-variant-numeric: tabular-nums lining-nums;
	font-weight: normal;
}
.house-an-row p { margin: 0; color: var(--h-mut); font-size: 13.5px; }

.house-extremes {
	width: 100%;
	border-collapse: collapse;
	font-size: 13.5px;
	font-variant-numeric: tabular-nums;
}
.house-extremes th, .house-extremes td { text-align: right; padding: 6px 4px; border-top: 1px solid var(--h-line-soft); }
.house-extremes th:first-child, .house-extremes td:first-child { text-align: left; }
.house-extremes th { color: var(--h-faint); font-weight: normal; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; }
.house-extremes td { font-variant-numeric: tabular-nums; color: var(--h-ink); }

/* Timeline + logbook */
.house-event { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--h-line-soft); font-size: 14px; }
.house-event:first-of-type { border-top: none; }
.house-event > div { flex: 1 1 auto; min-width: 0; }
.house-event-mark { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--h-mut); }
.house-event-mark svg { width: 100%; height: 100%; }
.house-event.is-critical .house-event-mark { color: var(--h-crit-text); }
.house-event.is-warning .house-event-mark { color: var(--h-warn-text); }
.house-event.is-info .house-event-mark { color: var(--h-info-text); }
.house-event.is-cleared .house-event-mark { color: var(--h-accent); }
.house-event-where { color: var(--h-faint); font-size: 12.5px; }

.house-due {
	display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px;
}
.house-due span {
	font-size: 13px;
	border: 1px solid var(--h-line);
	border-radius: 20px;
	padding: 4px 12px;
	color: var(--h-mut);
	background: var(--h-panel);
}
.house-due span.is-overdue { border-color: var(--h-crit-edge); color: var(--h-crit-text); background: var(--h-crit-bg); }

.house-log-form { display: grid; gap: 10px; margin: 0 0 14px; }
.house-log-form[hidden] { display: none !important; }
.house-log-form input, .house-log-form textarea, .house-log-form select {
	background: var(--h-panel);
	border: 1px solid var(--h-ctl-edge);
	border-radius: 10px;
	color: var(--h-ink);
	font-size: 14.5px;
	padding: 10px 12px;
	width: 100%;
	box-sizing: border-box;
	font-family: inherit;
}
.house-log-form input:focus, .house-log-form textarea:focus, .house-log-form select:focus {
	border-color: var(--h-accent);
	box-shadow: 0 0 0 3px var(--h-accent-tint);
	outline: none;
}
.house-log-cats { display: flex; gap: 6px; flex-wrap: wrap; }
.house-log-cats label span {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	font-size: 13.5px;
	border: 1px solid var(--h-line);
	border-radius: 20px;
	padding: 5px 12px;
	color: var(--h-mut);
	background: var(--h-panel);
	cursor: pointer;
}
.house-log-cats input { position: absolute; opacity: 0; pointer-events: none; width: auto; }
.house-log-cats input:checked + span { border-color: var(--h-accent); color: var(--h-accent-ink); background: var(--h-accent-tint); font-weight: 600; }
.house-log-cats input:focus-visible + span { outline: 2px solid var(--h-accent); }

.house-log-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Properties list: a grid of cards on desktop, one column below. */
.house-list {
	display: grid;
	grid-template-columns: 1fr;
	gap: 14px;
	list-style: none;
	margin: 0;
	padding: 0;
}
.house-prop {
	display: block;
	background: var(--h-panel);
	border: 1px solid var(--h-line);
	border-radius: 14px;
	padding: 16px 18px;
	color: inherit;
	min-height: 0;
}
a.house-prop:hover { background: var(--h-hover); }
a.house-prop { text-decoration: none; }
.house-prop h2 { font-family: Georgia, "Iowan Old Style", Palatino, serif; font-weight: 400; font-size: 20px; margin: 0 0 2px; display: flex; align-items: center; gap: 10px; }
.house-prop-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.house-prop .house-addr { color: var(--h-faint); font-size: 13.5px; margin: 0 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.house-prop .house-addr:empty { display: none; }
.house-prop .house-state { font-size: 14px; margin: 0 0 6px; color: var(--h-mut); }
.house-prop .house-state strong { color: var(--h-ink); font-weight: 600; }
.house-prop .house-headline {
	font-size: 13.5px;
	margin: 0 0 6px;
	color: var(--h-ink-soft);
	font-variant-numeric: tabular-nums;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.house-prop .house-meta { color: var(--h-faint); font-size: 12.5px; margin: 0; font-variant-numeric: tabular-nums; }
a.house-prop:focus-visible { outline: 3px solid var(--h-accent); outline-offset: 2px; border-color: var(--h-accent); }

/* Ghost add-card: the one entry point for a new property. */
button.house-prop.is-add {
	width: 100%;
	font: inherit;
	text-align: left;
	cursor: pointer;
	border-style: dashed;
	border-width: 1.5px;
	background: none;
	color: var(--h-mut);
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 2px;
	min-height: 120px;
}
button.house-prop.is-add:hover { border-color: var(--h-accent); color: var(--h-accent-ink); background: var(--h-hover); }
button.house-prop.is-add:disabled { opacity: .55; cursor: default; }
button.house-prop.is-add:disabled:hover { border-color: var(--h-line); color: var(--h-mut); background: none; }
.house-add-mark { font-size: 26px; line-height: 1; color: var(--h-accent); }
.house-add-t { font-size: 16px; font-weight: 600; color: var(--h-ink); }
.house-add-s { font-size: 13px; color: var(--h-faint); }
.house-prop.is-skel { min-height: 150px; background: var(--h-skel); border: none; animation: house-pulse 1.6s ease-in-out infinite; }

/* Add-property form + inline errors */
.house-form-err {
	color: var(--h-crit-text);
	background: var(--h-crit-bg);
	border: 1px solid var(--h-crit-edge);
	border-radius: 10px;
	padding: 10px 12px;
	font-size: 14px;
	margin: 0;
}
.house-form-err[hidden] { display: none !important; }
.house-opt { font-weight: 400; text-transform: none; letter-spacing: 0; }
#house-add-wrap[hidden] { display: none !important; }

/* Display tab: headline picker + visibility */
.house-display-group {
	border: none;
	padding: 0;
	margin: 0 0 12px;
	display: grid;
	gap: 0;
}
.house-display-group legend { padding: 0; margin-bottom: 4px; }
.house-pick {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 14.5px;
	padding: 10px 2px;
	min-height: 44px;
	border-top: 1px solid var(--h-line-soft);
	cursor: pointer;
	color: var(--h-ink-soft);
	font-variant-numeric: tabular-nums;
}
.house-pick:first-of-type { border-top: none; }
.house-pick input {
	width: 22px;
	height: 22px;
	flex: none;
	accent-color: var(--h-accent);
}
.house-pick.is-off { color: var(--h-faint); }
.house-display-note { font-size: 13px; color: var(--h-faint); margin: 8px 0 0; }

/* Modes */
.house-modes { display: flex; gap: 8px; flex-wrap: wrap; }
.house-mode {
	display: inline-flex;
	align-items: center;
	font-size: 13.5px;
	border: 1px solid var(--h-line);
	border-radius: 20px;
	padding: 5px 12px;
	min-height: 44px;
	color: var(--h-mut);
	background: var(--h-panel);
	cursor: pointer;
	font-family: inherit;
}
.house-mode.is-on { border-color: var(--h-accent); color: var(--h-accent-ink); background: var(--h-accent-tint); font-weight: 600; }

/* Layout with the left menu */
.house-wrap { display: flex; gap: 20px; align-items: flex-start; }
.house-main { flex: 1; min-width: 0; }

.house-nav {
	flex: none;
	width: 196px;
	position: sticky;
	top: 12px;
	display: flex;
	flex-direction: column;
	gap: 2px;
	background: var(--h-panel);
	border: 1px solid var(--h-line);
	border-radius: 14px;
	padding: 8px;
}

.house-nav a {
	display: flex;
	align-items: center;
	gap: 10px;
	color: var(--h-mut);
	font-size: 14.5px;
	line-height: 20px;
	padding: 10px 12px;
	min-height: 44px;
	border-radius: 9px;
	text-decoration: none;
}

.house-nav a:hover { color: var(--h-ink); background: var(--h-raised); }
.house-nav a.is-on { color: var(--h-ink); font-weight: 600; background: var(--h-accent-tint); box-shadow: inset 3px 0 0 var(--h-accent); }
.house-nav-back { border-top: 1px solid var(--h-line-soft); margin-top: 4px; border-radius: 0 0 9px 9px; }

.house-nav-dot { width: 18px; font-size: 18px; text-align: center; flex: none; color: var(--h-faint); }
.house-nav a.is-on .house-nav-dot { color: var(--h-accent); }

.house-badge {
	margin-left: auto;
	font-size: 11.5px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .06em;
	font-variant-numeric: tabular-nums;
	border: 1px solid var(--h-warn-edge);
	color: var(--h-warn-text);
	background: var(--h-warn-bg);
	border-radius: 999px;
	padding: 2px 10px;
	white-space: nowrap;
}

.house-badge.is-critical { border-color: var(--h-crit-edge); color: var(--h-crit-text); background: var(--h-crit-bg); }

/* Alerts list rows: hairlines, words always, bar only for critical. */
.house-alertrow {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	padding: 12px 2px;
	border-top: 1px solid var(--h-line-soft);
	border-radius: 8px;
	color: inherit;
	text-decoration: none;
}

.house-alertrow:first-of-type { border-top: none; }
.house-alertrow:hover { background: var(--h-hover); }
/* Long unbroken alert titles wrap instead of forcing the row wide. */
.house-alertrow > div { min-width: 0; overflow-wrap: break-word; }

.house-sev {
	flex: none;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .07em;
	border: 1px solid var(--h-line);
	border-radius: 999px;
	padding: 3px 10px;
	color: var(--h-mut);
	background: var(--h-paper);
}

.house-alertrow.is-warning .house-sev { border-color: var(--h-warn-edge); color: var(--h-warn-text); background: var(--h-warn-bg); }
.house-event .house-sev { align-self: flex-start; }
.house-event.is-warning .house-sev { border-color: var(--h-warn-edge); color: var(--h-warn-text); background: var(--h-warn-bg); }
.house-event.is-info .house-sev { border-color: var(--h-info-edge); color: var(--h-info-text); background: var(--h-info-bg); }
.house-event.is-critical .house-sev { border-color: var(--h-crit-edge); color: var(--h-crit-text); background: var(--h-crit-bg); }
.house-alertrow.is-critical .house-sev { border-color: var(--h-crit-edge); color: var(--h-crit-text); background: var(--h-crit-bg); }
.house-alertrow.is-info .house-sev { border-color: var(--h-info-edge); color: var(--h-info-text); background: var(--h-info-bg); }
.house-alertrow.is-critical { border-left: 3px solid var(--h-crit-edge-strong); padding-left: 10px; }

/* Management: pencils, inline forms, adopt cards */
.house-pencil {
	background: none;
	border: none;
	color: var(--h-faint);
	font-size: 16px;
	cursor: pointer;
	padding: 2px 6px;
	min-width: 44px;
	min-height: 44px;
	border-radius: 6px;
	font-family: inherit;
}

.house-pencil:hover { color: var(--h-accent); }
.house-pencil:disabled { opacity: .35; cursor: default; }
.house-pencil:disabled:hover { color: var(--h-faint); }

.house-room-title { overflow: hidden; text-overflow: ellipsis; }

.house-rename-input {
	background: var(--h-panel);
	border: 1px solid var(--h-accent);
	border-radius: 8px;
	color: var(--h-ink);
	font-size: 14px;
	padding: 6px 10px;
	min-width: 140px;
	max-width: 100%;
	font-family: inherit;
}

.house-rename-title { font-size: 28px; }

.house-inline-form { display: flex; gap: 8px; margin: 0 0 12px; }
.house-inline-form input, .house-adopt input, .house-adopt select, .house-mini {
	background: var(--h-panel);
	border: 1px solid var(--h-ctl-edge);
	border-radius: 9px;
	color: var(--h-ink);
	font-size: 13.5px;
	padding: 8px 10px;
	min-height: 44px;
	box-sizing: border-box;
	font-family: inherit;
}

.house-inline-form input::placeholder, .house-adopt input::placeholder, .house-log-form input::placeholder, .house-log-form textarea::placeholder { color: var(--h-placeholder); }

.house-inline-form input { flex: 1; min-width: 0; font-size: 14.5px; padding: 10px 12px; border-radius: 10px; }
.house-inline-form input:focus, .house-adopt input:focus, .house-adopt select:focus, .house-mini:focus, .house-hist-ctl select:focus {
	border-color: var(--h-accent);
	box-shadow: 0 0 0 3px var(--h-accent-tint);
	outline: none;
}

.house-mini { max-width: 130px; padding: 5px 8px; font-size: 12.5px; }
.house-dev-ctl { display: flex; align-items: center; gap: 8px; flex: none; }
.house-dev-ctl .house-btn { flex: none; white-space: nowrap; }
/* Room rows carry the move picker plus nowrap values: let the controls
 * shrink and wrap instead of spilling past the card. */
.is-room .house-dev-ctl { flex: 1 1 auto; flex-wrap: wrap; justify-content: flex-end; min-width: 0; }

/* Screen-reader-only text: the room health dot and badge colour alone. */
.house-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.house-adopt {
	background: var(--h-panel);
	border: 1px solid var(--h-line);
	border-radius: 12px;
	padding: 14px;
	margin: 0 0 10px;
	display: grid;
	gap: 10px;
}

.house-adopt label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--h-faint); }
.house-adopt label input, .house-adopt label select { font-weight: 400; text-transform: none; letter-spacing: 0; }

/* ---------- desktop: fluid shell, no max-width; everything below stays single-column ---------- */
@media (min-width: 1100px) {
	.house { max-width: none; margin: 0; padding: 32px clamp(16px, 3vw, 48px) 96px; }
	.house-wrap { gap: 24px; max-width: none; }
	.house-main { flex: 1 1 auto; min-width: 0; }
	.house-nav { flex: none; width: 196px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }

	/* Overview: alerts (5) beside readings (7), modes + timeline full width. */
	.house-main:has(#house-tabs [data-tab="overview"][aria-selected="true"]) #house-body {
		display: grid;
		grid-template-columns: repeat(12, minmax(0, 1fr));
		gap: 20px;
		align-items: start;
	}
	.house-main:has(#house-tabs [data-tab="overview"][aria-selected="true"]) #house-body > .house-card,
	.house-main:has(#house-tabs [data-tab="overview"][aria-selected="true"]) #house-body > #house-timeline {
		margin: 0;
		min-width: 0;
	}
	.house-main:has(#house-tabs [data-tab="overview"][aria-selected="true"]) .is-ov-alerts { grid-column: span 5; }
	.house-main:has(#house-tabs [data-tab="overview"][aria-selected="true"]) .is-ov-readings { grid-column: span 7; }
	.house-main:has(#house-tabs [data-tab="overview"][aria-selected="true"]) .is-ov-readings:first-child { grid-column: 1 / -1; }
	.house-main:has(#house-tabs [data-tab="overview"][aria-selected="true"]) .is-ov-modes { grid-column: 1 / -1; }
	.house-main:has(#house-tabs [data-tab="overview"][aria-selected="true"]) #house-timeline { grid-column: 1 / -1; min-width: 0; }
	.house-main:has(#house-tabs [data-tab="overview"][aria-selected="true"]) #house-timeline > .house-card { margin: 0; min-width: 0; }

	/* Rooms: auto-fill cards, management full width. */
	.house-main:has(#house-tabs [data-tab="rooms"][aria-selected="true"]) #house-body {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
		gap: 20px;
		align-items: start;
	}
	.house-main:has(#house-tabs [data-tab="rooms"][aria-selected="true"]) #house-body > .house-card {
		margin: 0;
		min-width: 0;
	}
	.house-main:has(#house-tabs [data-tab="rooms"][aria-selected="true"]) .is-rooms-manage { grid-column: 1 / -1; }

	/* Display tab: same auto-fill rhythm as rooms. */
	.house-main:has(#house-tabs [data-tab="display"][aria-selected="true"]) #house-body {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
		gap: 20px;
		align-items: start;
	}
	.house-main:has(#house-tabs [data-tab="display"][aria-selected="true"]) #house-body > .house-card {
		margin: 0;
		min-width: 0;
	}
	.house-main:has(#house-tabs [data-tab="display"][aria-selected="true"]) .is-display-wide { grid-column: 1 / -1; }

	/* Properties: auto-fill cards. The ghost keeps its 120px floor
	 * and stretches to the row: grid stretch makes the <li> definite, so
	 * height:100% resolves where min-height:100% collapsed to auto. */
	.house-list { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 14px; }
	.house-list > li { min-width: 0; display: flex; flex-direction: column; }
	.house-list > li > .house-prop { flex: 1 1 auto; width: 100%; height: auto; }
	button.house-prop.is-add { min-height: 120px; height: 100%; }

	/* History: stacked single column until 1320px, so the chart keeps the
	 * full main width instead of being squeezed beside an aside. */
	.house-main:has(#house-tabs [data-tab="history"][aria-selected="true"]) #house-body {
		display: grid;
		grid-template-columns: minmax(0, 1fr);
		gap: 20px;
		align-items: start;
	}
	.house-main:has(#house-tabs [data-tab="history"][aria-selected="true"]) #house-body > .house-card {
		margin: 0;
		min-width: 0;
	}
	.house-chart { min-width: 0; }

	/* History controls keep a full row-gap once they wrap beside the aside. */
	.house-hist-ctl { row-gap: 12px; }

	/* Blowout guards: every flex/grid text child can shrink. */
	#house-body { min-width: 0; }
	#house-body > * { min-width: 0; }
	.house-dev { min-width: 0; }
	.house-dev-name, .house-dev-val { min-width: 0; }
	.house-event > div { min-width: 0; }
}

/* History side-by-side only once the chart column stays wider than the
 * single-column chart just below 1100px: at 1100–1319px the analysis
 * column would squeeze the chart narrower than a wider viewport deserves.
 * The aside clamps 280–360px; the chart column takes the rest. */
@media (min-width: 1320px) {
	.house-main:has(#house-tabs [data-tab="history"][aria-selected="true"]) #house-body {
		grid-template-columns: minmax(0, 1fr) clamp(280px, 22vw, 360px);
		gap: 0 20px;
	}
	.house-main:has(#house-tabs [data-tab="history"][aria-selected="true"]) .is-history-chart { grid-column: 1; min-width: 0; }
	.house-main:has(#house-tabs [data-tab="history"][aria-selected="true"]) .is-history-analysis {
		grid-column: 2;
		position: sticky;
		top: 16px;
		min-width: 0;
		max-height: calc(100vh - 32px);
		overflow-y: auto;
	}
	.house-extremes td:first-child {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		max-width: 18ch;
	}
}

/* Logbook: inner text measure caps on wide screens; the card itself stays
 * full main width. */
@media (min-width: 1450px) {
	.house-main:has(#house-tabs [data-tab="logbook"][aria-selected="true"]) #house-log { max-width: 78ch; }
}

/* Ultrawide: prose measure caps (text blocks only, never the shell) and
 * wider optical gaps. Display has exactly 3 cards, so they lock to 3
 * equal columns with the banner un-spanned. */
@media (min-width: 1800px) {
	.house-main:has(#house-tabs [data-tab="overview"][aria-selected="true"]) .is-ov-alerts .house-event > div,
	.house-main:has(#house-tabs [data-tab="overview"][aria-selected="true"]) #house-timeline .house-event > div {
		min-width: 0;
		max-width: 70ch;
		overflow-wrap: break-word;
	}
	.house-main:has(#house-tabs [data-tab="logbook"][aria-selected="true"]) #house-log { max-width: 78ch; }
	.house-verdict-sub { max-width: 70ch; }
	.house-main:has(#house-tabs [data-tab="overview"][aria-selected="true"]) #house-body,
	.house-main:has(#house-tabs [data-tab="rooms"][aria-selected="true"]) #house-body,
	.house-main:has(#house-tabs [data-tab="display"][aria-selected="true"]) #house-body { gap: 24px; }
}

@media (min-width: 1920px) {
	.house-main:has(#house-tabs [data-tab="display"][aria-selected="true"]) #house-body {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
	.house-main:has(#house-tabs [data-tab="display"][aria-selected="true"]) .is-display-wide { grid-column: auto; }
}

@media (max-width: 720px) {
	.house-wrap { flex-direction: column; }
	.house-nav {
		width: 100%;
		position: static;
		flex-direction: row;
		overflow-x: auto;
		align-items: center;
		border-radius: 12px;
		padding: 6px;
	}
	.house-nav a { white-space: nowrap; }
	.house-nav a.is-on { box-shadow: inset 0 -2px 0 var(--h-accent); }
	.house-nav-back { border-top: none; margin-top: 0; margin-left: auto; }
}

@media (max-width: 560px) {
	.house { padding: 16px 14px 88px; }
	.house-title { font-size: 28px; line-height: 34px; }
	.house-pg { margin-left: 0; }
	.house-card { padding: 16px; }
	.house-prop { padding: 14px; }
	.house-prop h2 { font-size: 18px; }
	.house-vitals { grid-template-columns: 1fr; }
	.house-vital { border-left: none; border-top: 1px solid var(--h-line-soft); padding: 12px 2px; }
	.house-vital:first-child { border-top: none; }
	.house-hist-ctl { align-items: stretch; flex-direction: column; }
	.house-hist-ctl select { max-width: none; }
	.house-pg { margin-left: 0; }
	.house-pg .house-btn { flex: 1; }
	.house-theme { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.house-skel { animation: none; }
	.house-prop.is-skel { animation: none; }
	.house-tip { transition: none; }
	.house.theme-anim, .house.theme-anim * { transition: none !important; }
	.house * { transition: none !important; }
}
