/* Apprentice dashboards. Everything is scoped under .apr so the theme is left alone. */
.apr {
	--apr-brand: #046bd2;
	--apr-brand-dark: #045cb4;
	--apr-ink: #1e293b;
	--apr-ink-2: #475569;
	--apr-line: #d1d5db;
	--apr-surface: #ffffff;
	--apr-tint: #f0f5fa;
	--apr-good: #0f7b3f;
	--apr-good-bg: #e7f5ec;
	--apr-warn: #9a5b00;
	--apr-warn-bg: #fff4dc;
	--apr-crit: #b42318;
	--apr-crit-bg: #fdecea;
	--apr-cool: #046bd2;
	--apr-heat: #c2410c;
	--apr-series-1: #2a78d6;
	--apr-series-2: #eb6834;
	color: var(--apr-ink);
	font-size: 16px;
	line-height: 1.5;
	max-width: 1100px;
	margin: 0 auto;
}
.apr *, .apr *::before, .apr *::after { box-sizing: border-box; }
.apr h2 { font-size: 1.35rem; margin: 1.6em 0 .6em; color: var(--apr-ink); }
.apr h3 { font-size: 1.05rem; margin: 1.4em 0 .5em; color: var(--apr-ink); }
.apr h4 { font-size: .95rem; margin: 1.2em 0 .5em; color: var(--apr-ink-2); }
.apr p { margin: 0 0 .8em; }
.apr a { color: var(--apr-brand); }
.apr hr { border: 0; border-top: 1px solid var(--apr-line); margin: 1.2em 0; }
.apr blockquote { margin: .4em 0 1em; padding: .6em .9em; border-left: 3px solid var(--apr-line); background: var(--apr-tint); font-style: normal; font-size: 1em; }
.apr-muted { color: var(--apr-ink-2); font-size: .9em; }
.apr-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82em; }
.apr-grow { flex: 1 1 200px; }
.apr-signout { text-align: right; font-size: .9em; margin-top: 1em; }
.apr [hidden] { display: none !important; }

/* Cards */
.apr-card {
	background: var(--apr-surface);
	border: 1px solid var(--apr-line);
	border-radius: 10px;
	padding: 20px;
	margin: 0 0 20px;
}
.apr-card > h2:first-child, .apr-card > h3:first-child, .apr-system-head h2, .apr-system-head h3 { margin-top: 0; }
.apr-auth { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; align-items: start; }
.apr-auth .apr-card { margin: 0; }
.apr-system-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.apr-system-head h2, .apr-system-head h3 { margin-bottom: 0; }

/* Buttons */
.apr .apr-btn {
	display: inline-flex; align-items: center; justify-content: center;
	min-height: 40px; padding: 8px 16px;
	border: 1px solid var(--apr-line); border-radius: 6px;
	background: var(--apr-surface); color: var(--apr-ink);
	font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2;
	cursor: pointer; text-decoration: none; box-shadow: none;
}
.apr .apr-btn:hover { background: var(--apr-tint); color: var(--apr-ink); }
.apr .apr-btn:focus-visible, .apr .apr-link:focus-visible, .apr-table tr:focus-visible { outline: 2px solid var(--apr-brand); outline-offset: 2px; }
.apr .apr-btn-primary { background: var(--apr-brand); border-color: var(--apr-brand); color: #fff; }
.apr .apr-btn-primary:hover { background: var(--apr-brand-dark); color: #fff; }
.apr .apr-btn-danger { color: var(--apr-crit); }
.apr .apr-btn-danger:hover { background: var(--apr-crit-bg); color: var(--apr-crit); }
.apr .apr-btn[disabled] { opacity: .55; cursor: default; }
.apr .apr-btn-large { min-height: 52px; font-size: 1.05rem; width: 100%; }
.apr .apr-link { background: none; border: 0; padding: 0; color: var(--apr-brand); font: inherit; text-decoration: underline; cursor: pointer; box-shadow: none; }
.apr .apr-link:hover { background: none; color: var(--apr-brand-dark); }
.apr-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Forms */
.apr label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 12px; color: var(--apr-ink); }
.apr input[type="text"], .apr input[type="email"], .apr input[type="tel"], .apr input[type="password"],
.apr input[type="number"], .apr input[type="datetime-local"], .apr select, .apr textarea {
	display: block; width: 100%; min-height: 40px; margin-top: 4px; padding: 8px 10px;
	border: 1px solid var(--apr-line); border-radius: 6px;
	background: #fff; color: var(--apr-ink); font: inherit; font-weight: 400;
}
.apr textarea { min-height: 64px; resize: vertical; }
.apr-hint { display: block; font-weight: 400; color: var(--apr-ink-2); font-size: .82rem; margin-top: 3px; }
.apr-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.apr-inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.apr-inline-form input { flex: 1 1 180px; width: auto; margin-top: 0; text-transform: uppercase; }
.apr-error { color: var(--apr-crit); font-weight: 600; }
.apr-auth form p { margin-bottom: 12px; }
.apr-auth .login-remember label { font-weight: 400; }
.apr-auth input[type="submit"] {
	min-height: 40px; padding: 8px 16px; border: 1px solid var(--apr-brand); border-radius: 6px;
	background: var(--apr-brand); color: #fff; font-weight: 600; cursor: pointer;
}

/* Banners */
.apr-banner { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--apr-line); background: var(--apr-tint); display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.apr-banner-good { background: var(--apr-good-bg); border-color: #b7dfc5; }
.apr-banner-warn { background: var(--apr-warn-bg); border-color: #f0d9a4; display: block; }
.apr-banner-error { background: var(--apr-crit-bg); border-color: #f3c0bb; }

/* Status pills, chips */
.apr-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; white-space: nowrap; background: var(--apr-tint); color: var(--apr-ink); }
.apr-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--apr-ink-2); flex: none; }
.apr-pill-good { background: var(--apr-good-bg); }
.apr-pill-good .apr-dot { background: var(--apr-good); }
.apr-pill-alert { background: var(--apr-warn-bg); }
.apr-pill-alert .apr-dot { background: var(--apr-warn); }
.apr-pill-off .apr-dot { background: transparent; border: 2px solid var(--apr-ink-2); }
.apr-chip { display: inline-block; padding: 2px 8px; margin: 0 4px 4px 0; border-radius: 4px; border: 1px solid var(--apr-line); background: var(--apr-tint); font-size: .8rem; font-weight: 600; white-space: nowrap; }
.apr-chip-warning { background: var(--apr-warn-bg); border-color: #f0d9a4; }
.apr-chip-critical { background: var(--apr-crit-bg); border-color: #f3c0bb; color: var(--apr-crit); }
.apr-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.25rem; letter-spacing: .08em; }

.apr-icon { display: inline-flex; flex: none; width: 24px; height: 24px; }
.apr-icon svg { width: 100%; height: 100%; }

/* Customer: mode hero + readings */
.apr-mode { display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: 10px; background: var(--apr-tint); }
.apr-mode .apr-icon { width: 48px; height: 48px; color: var(--apr-ink-2); }
.apr-mode-cooling .apr-icon { color: var(--apr-cool); }
.apr-mode-heating .apr-icon, .apr-mode-hp_heat .apr-icon { color: var(--apr-heat); }
.apr-mode-label { font-size: 1.7rem; font-weight: 700; line-height: 1.15; }
.apr-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-top: 12px; }
.apr-tiles-wide { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.apr-tile { border: 1px solid var(--apr-line); border-radius: 8px; padding: 10px 14px; background: var(--apr-surface); }
.apr-tile-label { font-size: .8rem; color: var(--apr-ink-2); }
.apr-tile-value { font-size: 1.25rem; font-weight: 700; }
.apr-tiles-wide .apr-tile-value { font-size: 1.05rem; }

/* Alerts */
.apr ul.apr-alerts, .apr ul.apr-plain { list-style: none; margin: 0 0 1em; padding: 0; }
.apr ul.apr-plain li { padding: 8px 0; border-bottom: 1px solid var(--apr-line); }
.apr-alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; margin: 0 0 8px; border-radius: 8px; border: 1px solid var(--apr-line); background: var(--apr-tint); }
.apr-alert-warning { background: var(--apr-warn-bg); border-color: #f0d9a4; }
.apr-alert-warning .apr-icon { color: var(--apr-warn); }
.apr-alert-critical { background: var(--apr-crit-bg); border-color: #f3c0bb; }
.apr-alert-critical .apr-icon { color: var(--apr-crit); }
.apr-alert-ok { background: var(--apr-good-bg); border-color: #b7dfc5; align-items: center; }
.apr-alert-ok .apr-icon { color: var(--apr-good); }

/* Service */
.apr-service { display: flex; gap: 12px; padding: 14px; border-radius: 8px; border: 1px solid var(--apr-line); background: var(--apr-tint); }
.apr-service-scheduled { background: var(--apr-good-bg); border-color: #b7dfc5; }
.apr-service .apr-icon { color: var(--apr-good); }
.apr-service-title { font-weight: 700; }
.apr-service-when { font-size: 1.3rem; font-weight: 700; display: flex; gap: 8px; align-items: center; margin: 2px 0 6px; }
.apr-request textarea { margin-bottom: 10px; }
.apr-more { margin: 0 0 20px; }
.apr-more summary { cursor: pointer; color: var(--apr-brand); font-weight: 600; padding: 6px 0; }

/* Contractor */
.apr-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.apr-stat { border: 1px solid var(--apr-line); border-radius: 10px; padding: 14px 16px; background: var(--apr-surface); }
.apr-stat-label { font-size: .85rem; color: var(--apr-ink-2); }
.apr-stat-value { font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
.apr-stat-warn { background: var(--apr-warn-bg); border-color: #f0d9a4; }
.apr-stat-alert { background: var(--apr-brand); border-color: var(--apr-brand); }
.apr-stat-alert .apr-stat-label, .apr-stat-alert .apr-stat-value { color: #fff; }
.apr-request-new { border-left: 4px solid var(--apr-brand); }
.apr-meta { color: var(--apr-ink-2); font-size: .9rem; }
.apr-schedule { display: flex; gap: 0 12px; flex-wrap: wrap; align-items: flex-end; padding-top: 12px; border-top: 1px solid var(--apr-line); }
.apr-schedule label { flex: 0 1 210px; }
.apr-schedule label.apr-grow { flex: 1 1 240px; }
.apr-schedule .apr-actions { margin-bottom: 12px; }

.apr-table-wrap { overflow-x: auto; border: 1px solid var(--apr-line); border-radius: 10px; background: var(--apr-surface); }
.apr table.apr-table { width: 100%; border-collapse: collapse; margin: 0; border: 0; font-size: .92rem; }
.apr table.apr-table th, .apr table.apr-table td { padding: 10px 12px; text-align: left; border: 0; border-bottom: 1px solid var(--apr-line); vertical-align: middle; }
.apr table.apr-table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--apr-ink-2); background: var(--apr-tint); white-space: nowrap; }
.apr table.apr-table .apr-num { text-align: right; font-variant-numeric: tabular-nums; }
.apr table.apr-table tbody tr:last-child td { border-bottom: 0; }
.apr table.apr-table tbody tr[tabindex] { cursor: pointer; }
.apr table.apr-table tbody tr[tabindex]:hover td { background: var(--apr-tint); }
.apr table.apr-table tbody tr.apr-row-open td { background: #e3eefb; }

.apr-detail { margin-top: 28px; padding: 20px; border: 2px solid var(--apr-brand); border-radius: 12px; background: #fbfdff; }
.apr-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 24px; align-items: start; }
.apr-forms .apr-card { margin: 0; }
.apr-forms .apr-settings { grid-column: 1 / -1; }

/* Chart */
.apr-chart { border: 1px solid var(--apr-line); border-radius: 10px; padding: 12px; background: #fcfcfb; }
.apr-chart-plot { position: relative; }
.apr-chart svg { display: block; max-width: 100%; height: auto; }
.apr-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .85rem; color: var(--apr-ink-2); margin-bottom: 6px; }
.apr-swatch { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.apr-swatch.apr-s1 { background: var(--apr-series-1); }
.apr-swatch.apr-s2 { background: var(--apr-series-2); }
.apr-grid { stroke: #e5e7eb; stroke-width: 1; }
.apr-axis { fill: var(--apr-ink-2); font-size: 11px; }
.apr-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.apr-line.apr-s1, .apr-dotmark.apr-s1 { stroke: var(--apr-series-1); }
.apr-line.apr-s2, .apr-dotmark.apr-s2 { stroke: var(--apr-series-2); }
.apr-dotmark { fill: #fcfcfb; stroke-width: 2; }
.apr-dotmark.apr-s1 { fill: var(--apr-series-1); stroke: #fcfcfb; }
.apr-dotmark.apr-s2 { fill: var(--apr-series-2); stroke: #fcfcfb; }
.apr-cross { stroke: var(--apr-ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.apr-tip { position: absolute; top: 4px; transform: translateX(-50%); pointer-events: none; background: #fff; border: 1px solid var(--apr-line); border-radius: 6px; padding: 6px 10px; font-size: .82rem; white-space: nowrap; box-shadow: 0 2px 8px rgba(15, 23, 42, .12); }

@media (max-width: 600px) {
	.apr-card, .apr-detail { padding: 16px; }
	.apr-mode-label { font-size: 1.4rem; }
	.apr-schedule label { flex: 1 1 100%; }
}

/* Tabs (contractor dashboard) */
.apr-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--apr-line); margin: 0 0 20px; }
.apr .apr-tab { background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: 10px 14px; margin-bottom: -1px; font: inherit; font-weight: 600; color: var(--apr-ink-2); cursor: pointer; box-shadow: none; }
.apr .apr-tab:hover { color: var(--apr-ink); background: none; }
.apr .apr-tab-active { color: var(--apr-brand); border-bottom-color: var(--apr-brand); }
.apr .apr-tab:focus-visible { outline: 2px solid var(--apr-brand); outline-offset: -2px; }

/* Firmware + overrides */
.apr-pill-bad { background: var(--apr-crit-bg); }
.apr-pill-bad .apr-dot { background: var(--apr-crit); }
.apr-chip-stable { background: var(--apr-good-bg); border-color: #b7dfc5; }
.apr-chip-beta { background: #ede9fe; border-color: #c4b5fd; }
.apr-chip-custom { background: #e3eefb; border-color: #9cc3ee; margin: 2px 0 0; }
.apr input::placeholder { color: #94a3b8; }
.apr code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; background: var(--apr-tint); padding: 1px 4px; border-radius: 3px; }
.apr input[type="file"] { display: block; margin-top: 4px; font-weight: 400; }

/* Fleet "own values" dialog */
.apr .apr-dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 64px); border: 1px solid var(--apr-line); border-radius: 12px; padding: 24px; color: var(--apr-ink); background: var(--apr-surface); box-shadow: 0 12px 40px rgba(15, 23, 42, .25); }
.apr .apr-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.apr .apr-dialog h2 { margin-top: 0; }
.apr .apr-dialog-row { padding: 10px 0; }
.apr label.apr-check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 0; cursor: pointer; }
.apr label.apr-check input { width: 18px; height: 18px; margin-top: 3px; flex: none; }
.apr-dialog-buttons { margin-top: 16px; }

/* v0.3: firmware version next to the system name, service panel */
.apr h2 .apr-fw { display: block; font-size: .72rem; font-weight: 400; color: var(--apr-ink-2); letter-spacing: .01em; margin-top: 2px; }
.apr-service-panel { margin-top: 16px; }
.apr-service-panel h4 { margin-top: 1.2em; }

/* v0.4: module search, filters, paging; stat tiles as shortcuts */
.apr button.apr-stat { display: block; width: 100%; text-align: left; font: inherit; color: var(--apr-ink); cursor: pointer; box-shadow: none; }
.apr button.apr-stat:hover { border-color: var(--apr-brand); }
.apr button.apr-stat:focus-visible { outline: 2px solid var(--apr-brand); outline-offset: 2px; }
.apr .apr-stat-label, .apr .apr-stat-value { display: block; }
.apr-stat-bad { background: var(--apr-crit-bg); border-color: #f3c0bb; }
.apr-stat-bad .apr-stat-value { color: var(--apr-crit); }
.apr-list-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.apr .apr-list-tools input[type="search"] { flex: 1 1 280px; width: auto; margin: 0; min-height: 44px; font-size: 1rem; padding: 8px 12px; border: 1px solid var(--apr-line); border-radius: 8px; }
.apr .apr-list-tools select { flex: 0 1 230px; width: auto; margin: 0; min-height: 44px; }
.apr-filter-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.apr .apr-filter { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 12px; border: 1px solid var(--apr-line); border-radius: 999px; background: var(--apr-surface); color: var(--apr-ink); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; box-shadow: none; }
.apr .apr-filter:hover { border-color: var(--apr-brand); background: var(--apr-surface); color: var(--apr-ink); }
.apr .apr-filter-on, .apr .apr-filter-on:hover { background: var(--apr-brand); border-color: var(--apr-brand); color: #fff; }
.apr-filter-n { font-weight: 400; font-variant-numeric: tabular-nums; opacity: .8; }
.apr-list-summary { margin: 4px 0 8px; min-height: 1.4em; }
.apr-pager { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.apr .apr-pager select { width: auto; margin: 0 0 0 auto; }
.apr-empty { text-align: center; }

/* v0.5: tags, selection + bulk changes, map */
.apr-chip-tag { background: #eef2ff; border-color: #c7d2fe; color: #3730a3; font-weight: 600; }
.apr-row-tags { margin-top: 4px; }
.apr-row-tags .apr-chip { font-size: .72rem; padding: 1px 6px; }
.apr-tag-list { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.apr .apr-chip-x { border: 0; background: none; color: inherit; font: inherit; font-weight: 700; padding: 0 0 0 6px; cursor: pointer; box-shadow: none; min-height: 0; }
.apr .apr-chip-x:hover { color: var(--apr-crit); background: none; }
.apr-tag-form input { text-transform: none; }
.apr .apr-list-tools select[aria-label^="Show modules with"] { flex: 0 1 200px; }
.apr-seg { display: inline-flex; border: 1px solid var(--apr-line); border-radius: 8px; overflow: hidden; }
.apr .apr-seg-btn { border: 0; border-radius: 0; background: var(--apr-surface); color: var(--apr-ink); font: inherit; font-weight: 600; padding: 0 16px; min-height: 44px; cursor: pointer; box-shadow: none; }
.apr .apr-seg-btn + .apr-seg-btn { border-left: 1px solid var(--apr-line); }
.apr .apr-seg-on, .apr .apr-seg-on:hover { background: var(--apr-brand); color: #fff; }
.apr-check-cell { width: 36px; }
.apr .apr-check-cell input { width: 18px; height: 18px; margin: 0; cursor: pointer; }
.apr-selbar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 10px 14px; margin: 0 0 8px; border: 1px solid #9cc3ee; border-radius: 10px; background: #e3eefb; position: sticky; top: 0; z-index: 5; }
.apr-selbar-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.apr-bulk-row { display: grid; grid-template-columns: minmax(150px, 1fr) 160px minmax(140px, 1fr); gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--apr-line); }
.apr .apr-bulk-row select, .apr .apr-bulk-row input { margin: 0; }
.apr-bulk-label { font-weight: 600; font-size: .9rem; }
.apr .apr-dialog { max-width: 760px; width: min(760px, calc(100vw - 32px)); }
.apr-map-wrap { margin-top: 4px; }
.apr-map { height: 560px; border: 1px solid var(--apr-line); border-radius: 10px; z-index: 0; }
.apr-map-legend { margin: 0 0 8px; }
.apr-map-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #94a3b8; margin-right: 6px; vertical-align: -1px; }
.apr-map-note { margin-top: 8px; }
.apr-pop { font: 14px/1.4 -apple-system, "Segoe UI", Roboto, sans-serif; display: grid; gap: 2px; }
.apr-pop .apr-btn { margin-top: 6px; min-height: 34px; }
@media (max-width: 600px) {
	.apr-map { height: 420px; }
	.apr-bulk-row { grid-template-columns: 1fr 1fr; }
	.apr-bulk-label { grid-column: 1 / -1; }
	.apr-selbar-actions { margin-left: 0; }
}

/* v0.6: run history */
.apr {
	--apr-run-cool: #2a78d6;
	--apr-run-heat: #eb6834;
	--apr-run-aux: #b42318;
	--apr-temp-out: #4a3aa7;
	--apr-temp-in: #1baf7a;
}
.apr-mode-aux .apr-icon { color: var(--apr-run-aux); }
.apr-runhist { margin-bottom: 8px; }
.apr-lastrun { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 1rem; margin-bottom: 2px; }
.apr-chart-title { font-weight: 600; font-size: .9rem; margin: 14px 0 4px; }
.apr-chart-sub { font-size: .82rem; color: var(--apr-ink-2); margin: 8px 0 2px; }
.apr-chart-note { margin-top: 6px; }
.apr-swatch-box { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.apr-swatch-line { display: inline-block; width: 18px; height: 0; border-top: 2px solid; margin-right: 6px; vertical-align: middle; }
.apr-swatch-box.apr-run-cool { background: var(--apr-run-cool); }
.apr-swatch-box.apr-run-heat { background: var(--apr-run-heat); }
.apr-swatch-box.apr-run-aux { background: var(--apr-run-aux); }
.apr-swatch-line.apr-line-out { border-color: var(--apr-temp-out); }
.apr-swatch-line.apr-line-in { border-color: var(--apr-temp-in); }
.apr-swatch-line.apr-line-low { border-top-style: dashed; }
.apr-bar.apr-run-cool { fill: var(--apr-run-cool); }
.apr-bar.apr-run-heat { fill: var(--apr-run-heat); }
.apr-bar.apr-run-aux { fill: var(--apr-run-aux); }
.apr-line.apr-line-out, .apr-dotmark.apr-line-out { stroke: var(--apr-temp-out); }
.apr-line.apr-line-in, .apr-dotmark.apr-line-in { stroke: var(--apr-temp-in); }
.apr-line.apr-line-low { stroke-dasharray: 5 4; }
.apr-line.apr-line-avg { stroke-width: 2.5; }
.apr-dotmark.apr-line-out { fill: var(--apr-temp-out); stroke: #fcfcfb; }
.apr-dotmark.apr-line-in { fill: var(--apr-temp-in); stroke: #fcfcfb; }
.apr-hover-col { fill: #e2e8f0; opacity: .6; }
.apr-empty-note { font-size: 13px; }
.apr-runhist .apr-legend { margin: 6px 0 0; }

/* v0.7: animated system diagram */
.apr-sys { margin: 14px 0 4px; border: 1px solid var(--apr-line); border-radius: 10px; background: #fcfcfb; padding: 8px 8px 2px; }
.sys { display: block; width: 100%; height: auto; max-width: 760px; margin: 0 auto; font-family: inherit; }
.sys-caption { text-align: center; margin: 2px 6px 8px; font-size: .82rem; }
.sys-duct { fill: #eef2f7; stroke: #94a3b8; stroke-width: 2; }
.sys-cab { fill: #f8fafc; stroke: #64748b; stroke-width: 2; }
.sys-condenser { fill: #f1f5f9; }
.sys-pad { fill: #cbd5e1; }
.sys-hatch { stroke: #94a3b8; stroke-width: 1.5; }
.sys-filter { stroke: #64748b; stroke-width: 1; }
.sys-label { fill: #334155; font-size: 12px; font-weight: 600; }
.sys-label-small { font-size: 10px; font-weight: 500; fill: #64748b; }
.sys-wall { stroke: #94a3b8; stroke-width: 2; stroke-dasharray: 6 6; }
/* air */
.sys-flow { fill: none; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 14 12; opacity: 0; transition: opacity .6s; }
.blower-on .sys-flow { opacity: .85; }
.sys-flow-return { stroke: #94a3b8; }
.sys-flow-supply { stroke: #64748b; }
.mode-cooling .sys-flow-supply { stroke: #2a78d6; }
.mode-heating .sys-flow-supply { stroke: #eb6834; }
.mode-aux .sys-flow-supply { stroke: #b42318; }
.mode-hp_heat .sys-flow-supply { stroke: #eb6834; }
.mode-hp_heat .sys-coil { fill: #fdba74; stroke: #c2410c; transition: fill 1s; }
.sys-flow-up { stroke-width: 3; }
.blower-on .sys-flow-up { opacity: .35; }
/* blower */
.sys-wheel-rim { fill: #e2e8f0; stroke: #475569; stroke-width: 2; }
.sys-vane { stroke: #475569; stroke-width: 2; stroke-linecap: round; }
.sys-hub { fill: #475569; }
/* heat exchanger + burners */
.sys-hx path { fill: rgba(235, 104, 52, calc(var(--glow, 0) * .45)); stroke: #94a3b8; stroke-width: 2; transition: fill 1s; }
.heat-on .sys-hx path { stroke: #c2410c; }
.sys-burner { fill: #64748b; }
.sys-flames { opacity: 0; transition: opacity .4s; }
.heat-on .sys-flames { opacity: 1; }
.sys-flame { fill: #f59e0b; }
.mode-aux .sys-flame { fill: #b42318; }
.sys-flame-core { fill: #2a78d6; opacity: .85; }
/* electric heat strips (air handler systems) */
.sys-strips { display: none; }
.is-air-handler .sys-strips { display: inline; }
.is-air-handler .sys-furnace { display: none; }
.sys-strip { fill: none; stroke: #94a3b8; stroke-width: 2.5; stroke-linejoin: round; transition: stroke .6s; }
.heat-on .sys-strip { stroke: #eb6834; filter: drop-shadow(0 0 3px rgba(235, 104, 52, .8)); }
.mode-aux .sys-strip { stroke: #b42318; filter: drop-shadow(0 0 3px rgba(180, 35, 24, .8)); }
/* coil + frost */
.sys-coil { fill: #cbd5e1; stroke: #64748b; stroke-width: 1.5; }
.sys-fins line { stroke: #94a3b8; stroke-width: 1; }
.sys-frost { transition: opacity 2s; }
.sys-ice { fill: rgba(191, 219, 254, .75); stroke: #93c5fd; stroke-width: 2; }
.is-icing .sys-ice { fill: rgba(224, 242, 254, .95); stroke: #60a5fa; stroke-width: 3; }
.sys-sparkle { stroke: #ffffff; stroke-width: 1.6; stroke-linecap: round; }
/* line set */
.sys-line-suction { fill: none; stroke: #1e293b; stroke-width: 9; stroke-linejoin: round; }
.sys-line-liquid { fill: none; stroke: #b45309; stroke-width: 4; stroke-linejoin: round; }
.sys-ref { fill: none; stroke-linecap: round; stroke-dasharray: 2 12; opacity: 0; }
.compressor-on .sys-ref { opacity: 1; }
.sys-ref-suction { stroke: #93c5fd; stroke-width: 4; }
.sys-ref-liquid { stroke: #fde68a; stroke-width: 2.5; }
/* condenser */
.sys-cfins line { stroke: #94a3b8; stroke-width: 1; }
.sys-fanguard { fill: #334155; stroke: #1e293b; stroke-width: 2; }
.sys-blades path { fill: #94a3b8; }
.sys-blades circle { fill: #1e293b; }
.sys-wave { fill: none; stroke: #eb6834; stroke-width: 3; stroke-linecap: round; }   /* opacity is animated */
/* temperatures */
.sys-badge rect { fill: #ffffff; stroke: #cbd5e1; stroke-width: 1.5; }
.sys-probe { fill: #1e293b; }
.sys-badge-label { fill: #475569; font-size: 10px; font-weight: 600; }
.sys-badge-value { fill: #0f172a; font-size: 15px; font-weight: 700; }
.sys-dt { fill: #334155; font-size: 13px; font-weight: 700; }
/* offline */
.sys-offline-note { fill: #475569; font-size: 15px; font-weight: 700; paint-order: stroke; stroke: #fcfcfb; stroke-width: 5px; }
.is-offline .sys-art { opacity: .4; filter: grayscale(1); }
@media (prefers-reduced-motion: reduce) {
	.sys-flow, .sys-frost, .sys-hx path, .sys-flames { transition: none; }
}
/* Small screens: the picture shrinks, so keep the temperatures and drop the small part labels. */
.apr-sys { container-type: inline-size; }
@container (max-width: 520px) {
	.sys-label { display: none; }
	.sys-badge-label { display: none; }
	.sys-badge-value { font-size: 22px; }
	.sys-dt { font-size: 18px; }
}

/* v0.8: collapsible sections */
.apr-section { border: 1px solid var(--apr-line); border-radius: 10px; background: var(--apr-surface); margin: 14px 0; }
.apr-section > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 12px 16px 12px 40px; position: relative; border-radius: 10px; }
.apr-section > summary::-webkit-details-marker { display: none; }
.apr-section > summary::before { content: ''; position: absolute; left: 16px; top: 18px; width: 8px; height: 8px; border-right: 2px solid var(--apr-ink-2); border-bottom: 2px solid var(--apr-ink-2); transform: rotate(-45deg); transition: transform .15s; }
.apr-section[open] > summary::before { transform: rotate(45deg); top: 15px; }
.apr-section > summary:hover { background: var(--apr-tint); }
.apr-section > summary:focus-visible { outline: 2px solid var(--apr-brand); outline-offset: 2px; }
.apr-section-title { font-weight: 700; font-size: 1.02rem; color: var(--apr-ink); }
.apr-section-note { font-size: .86rem; color: var(--apr-ink-2); }
.apr-section-body { padding: 0 16px 16px; }
.apr-section-body > .apr-sys:first-child { margin-top: 0; }
.apr-section .apr-section { margin: 12px 0 0; }
.apr-section .apr-section > summary { padding-top: 8px; padding-bottom: 8px; }
.apr-section .apr-section > summary::before { top: 14px; }
.apr-section .apr-section[open] > summary::before { top: 11px; }
.apr-mode-temps { font-size: .92rem; color: var(--apr-ink); margin-top: 2px; font-weight: 600; }
.apr-forms .apr-settings-wrap { grid-column: 1 / -1; }
.apr-settings-wrap .apr-section { margin: 0; }
.apr-settings-wrap .apr-settings { border: 0; padding: 0; margin: 0; }

/* Equipment on site */
.apr-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.apr-card-head h3 { margin: 0; }
.apr-equip-type { font-weight: 600; margin: 0 0 10px; }
.apr-equip-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 20px; }
.apr-equip-unit h4 { margin: 0 0 6px; font-size: .95rem; }
.apr-equip-unit dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.apr-equip-unit dt { color: var(--apr-ink-2); font-size: .85rem; }
.apr-equip-unit dd { margin: 0; overflow-wrap: anywhere; }
.apr-equip-unit dd.apr-mono { font-size: .95rem; }
.apr .apr-copy { margin-left: 8px; font-size: .8rem; }
.apr-equip-updated { margin: 12px 0 0; font-size: .85rem; }
.apr-equipment input.apr-mono { text-transform: uppercase; }
.apr-equip-filter { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 14px 0 0; }
.apr-equip-filter dt { color: var(--apr-ink-2); font-size: .85rem; }
.apr-equip-filter dd { margin: 0; font-weight: 600; }
.apr-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.apr-photo { position: relative; display: block; width: 76px; height: 76px; border-radius: 8px; overflow: hidden; border: 1px solid var(--apr-line); background: var(--apr-tint); }
.apr-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.apr-photo > a { display: block; width: 100%; height: 100%; }
.apr .apr-photo-x { position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: rgba(15, 23, 42, .75); color: #fff; font-size: 16px; line-height: 24px; cursor: pointer; }
.apr-photo-add { display: flex; align-items: center; justify-content: center; min-width: 76px; height: 76px; padding: 0 10px; border: 1px dashed var(--apr-line); border-radius: 8px; color: var(--apr-brand); font-size: .85rem; font-weight: 600; text-align: center; cursor: pointer; }
.apr-photo-add:focus-within { outline: 2px solid var(--apr-brand); outline-offset: 2px; }
.apr-photo-add.is-busy { color: var(--apr-ink-2); cursor: progress; }
.apr-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
