body.has-sidebar-layout {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    background: #fcfaf7;
}

.has-sidebar-layout > header {
    position: sticky;
    top: 0;
    z-index: 5;
    min-height: 76px;
    width: 100%;
    max-width: none;
    justify-content: space-between;
    padding: 0 32px;
    background: #002e1f;
    border: 0;
}

.has-sidebar-layout > header .menu { gap: 0; }
.has-sidebar-layout > header .menu a {
    display: flex;
    align-items: center;
    min-height: 76px;
    padding: 0 24px;
    color: #faf6e6;
    border-left: 1px solid rgb(250 246 230 / 16%);
}
.has-sidebar-layout > header .menu a.selected,
.has-sidebar-layout > header .menu a:hover { background: #00452e; }

.app-layout {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    min-height: calc(100vh - 160px);
}

.app-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px 16px;
    background: #f2f0e9;
    border-right: 1px solid #d8d6ce;
}
.app-sidebar .auth {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: -20px -16px 4px;
    padding: 18px 20px;
    border-bottom: 1px solid #d8d6ce;
}
.app-sidebar .auth button { padding: 0; border: 0; background: transparent; }
.app-building-select-label { color: #58645d; font-size: .8rem; }
.app-building-select { width: 100%; min-height: 66px; }
.app-sidebar-menu { display: grid; gap: 4px; }
.app-sidebar-menu a {
    padding: 12px 14px;
    color: #193f30;
    border-radius: 4px;
    text-decoration: none;
}
.app-sidebar-menu a:hover,
.app-sidebar-menu a.selected { background: #dce8df; color: #002e1f; }
.app-sidebar-menu a { display: flex; align-items: center; gap: 12px; }
.app-sidebar-icon { display: inline-grid; place-items: center; width: 22px; color: #126644; font-size: 1.15rem; }
.app-main { min-width: 0; padding: 28px clamp(20px, 4vw, 64px); }
.hub-footer { display: flex; justify-content: space-between; align-items: center; gap: 24px; width: 100%; max-width: none; padding: 20px 28px; border-top: 1px solid #d8d6ce; color: #58645d; }
.hub-footer a { color: #193f30; }
.hub-language-switch { margin-left: auto; }
.hub-theme-toggle { margin-left: auto; width: 40px; height: 40px; border: 1px solid rgb(250 246 230 / 35%); border-radius: 50%; background: transparent; color: #faf6e6; font-size: 1.25rem; cursor: pointer; }
.has-sidebar-layout .menu:has(+ .hub-theme-toggle) { margin-right: auto; }
.theme-dark .app-sidebar { background: #112b20; border-color: #345342; }
.theme-dark .app-sidebar .auth { border-color: #345342; }
.theme-dark .app-sidebar .auth,
.theme-dark .app-sidebar .auth a,
.theme-dark .app-sidebar .auth button,
.theme-dark .app-sidebar-menu a,
.theme-dark .app-building-select-label { color: #f2f0e9; }
.theme-dark .app-main { background: #002e1f; color: #faf6e6; }
.theme-dark .hub-page-intro h1,
.theme-dark .hub-panel h2 { color: #faf6e6; }
.theme-dark .hub-panel { background: #0d402f; border-color: #345342; }
.theme-dark .hub-page-intro>div>p:last-child,
.theme-dark .hub-building-summary>p,
.theme-dark .hub-empty-status p,
.theme-dark .hub-activity-empty p { color: #c4d1c8; }
.theme-dark .hub-footer { background: #002e1f; border-color: #345342; color: #c4d1c8; }
.theme-dark .hub-footer a { color: #faf6e6; }

@media (max-width: 760px) {
    .has-sidebar-layout > header { padding: 0 12px; }
    .has-sidebar-layout > header .menu a { min-height: 62px; padding: 0 10px; }
    .hub-theme-toggle { flex: 0 0 36px; width: 36px; height: 36px; margin-left: 8px; }
    .app-layout { grid-template-columns: 1fr; }
    .app-sidebar { gap: 12px; border-right: 0; border-bottom: 1px solid #d8d6ce; }
    .app-sidebar-menu { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .app-main { padding: 20px 16px; }
    .hub-footer { flex-wrap: wrap; padding: 18px 16px; }
    .hub-footer nav { gap: 12px; }
}

/* Hub product shell and components use the approved design-system tokens. */
body.hub-site:not(.has-sidebar-layout) {
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
}
body.hub-site:not(.has-sidebar-layout) > header { display: none; }
body.hub-site:not(.has-sidebar-layout) > header {
    width: 100%;
    max-width: none;
    min-height: 76px;
    padding: 0 24px;
    background: var(--nav-bg);
}
body.hub-site:not(.has-sidebar-layout) > .auth {
    display: grid;
    flex: 1;
    align-content: center;
    width: min(100% - 32px, 440px);
    max-width: 440px;
    margin: 48px auto;
    padding: 32px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
body.hub-site:not(.has-sidebar-layout) .hub-login-logo { display: block; width: min(100%, 280px); height: auto; margin: 0 auto; }
body.hub-site:not(.has-sidebar-layout) .hub-login-tagline { margin: 8px 0 24px; color: var(--ink-muted); font: 300 15px/24px var(--font-sans); text-align: center; }
body.hub-site:not(.has-sidebar-layout) .auth form { display: grid; gap: 20px; width: 100%; }
body.hub-site:not(.has-sidebar-layout) .auth-field { display: grid; gap: 8px; }
body.hub-site:not(.has-sidebar-layout) .auth-field label { color: var(--ink); font-size: 14px; font-weight: 400; }
body.hub-site:not(.has-sidebar-layout) .auth-field input { width: 100%; min-height: var(--control-lg); padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: 400 14px/20px var(--font-sans); }
body.hub-site:not(.has-sidebar-layout) .auth-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
body.hub-site:not(.has-sidebar-layout) .auth-actions button { min-height: var(--control-lg); padding: 0 20px; border: 0; border-radius: var(--radius-sm); background: var(--brand); color: var(--on-brand); font: 400 14px var(--font-sans); cursor: pointer; }
body.hub-site:not(.has-sidebar-layout) .auth-actions a { color: var(--brand-ink); font-size: 14px; }
body.hub-site:not(.has-sidebar-layout) .hub-login-language { position: relative; justify-self: center; margin-top: 4px; color: var(--ink); font-size: 14px; font-weight: 400; }
body.hub-site:not(.has-sidebar-layout) .hub-login-language summary { display: flex; min-height: 40px; align-items: center; gap: 9px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); cursor: pointer; list-style: none; }
body.hub-site:not(.has-sidebar-layout) .hub-login-language summary::-webkit-details-marker { display: none; }
body.hub-site:not(.has-sidebar-layout) .hub-login-language summary:hover,
body.hub-site:not(.has-sidebar-layout) .hub-login-language[open] summary { border-color: var(--brand); }
body.hub-site:not(.has-sidebar-layout) .hub-language-chevron { width: 7px; height: 7px; margin: -4px 0 0 2px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform 140ms ease; }
body.hub-site:not(.has-sidebar-layout) .hub-login-language[open] .hub-language-chevron { margin-top: 4px; transform: rotate(225deg); }
body.hub-site:not(.has-sidebar-layout) .hub-login-language-options { position: absolute; z-index: 5; top: calc(100% + 6px); left: 50%; display: grid; min-width: 160px; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 8px 24px rgb(20 45 35 / 12%); transform: translateX(-50%); }
body.hub-site:not(.has-sidebar-layout) .hub-login-language-options a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
body.hub-site:not(.has-sidebar-layout) .hub-login-language-options a:hover,
body.hub-site:not(.has-sidebar-layout) .hub-login-language-options a[aria-current="true"] { background: var(--bg); }
body.hub-site:not(.has-sidebar-layout) > .hub-footer .hub-language-switch { display: none; }
body.has-sidebar-layout {
    display: grid;
    grid-template-rows: 76px auto minmax(0, 1fr) auto;
    align-items: stretch;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-synthesis: none;
    font-weight: 300;
}
.has-sidebar-layout > header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: none;
    min-height: 76px;
    padding: 0 24px;
    background: var(--nav-bg);
}
.has-sidebar-layout > header .logo { display: grid; place-items: center; width: 48px; height: 48px; padding: 0; }
.has-sidebar-layout > header .logo img { width: 32px; height: 32px; object-fit: contain; }
.has-sidebar-layout > header .menu { gap: 4px; margin: 0 0 0 auto; background: transparent; }
.has-sidebar-layout > header .menu > li > a {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 16px;
    border-radius: var(--radius-sm);
    color: var(--nav-ink);
    font-size: 14px;
    font-weight: 400;
    text-decoration: none;
}
.has-sidebar-layout > header .menu > li > a.selected,
.has-sidebar-layout > header .menu > li > a:hover { background: var(--nav-active); color: var(--nav-ink); }
.has-sidebar-layout > header .menu > li > a:focus-visible,
.app-sidebar a:focus-visible,
.hub-theme-toggle:focus-visible,
.hub-sidebar-toggle:focus-visible { outline: 2px solid var(--nav-accent); outline-offset: 2px; }
.hub-theme-toggle,
.hub-sidebar-toggle { display: grid; place-items: center; width: 40px; height: 40px; padding: 8px; border: 1px solid var(--nav-line); border-radius: var(--radius-sm); background: transparent; color: var(--nav-ink); cursor: pointer; }
.hub-theme-toggle svg,
.hub-sidebar-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.hub-sidebar-toggle { display: none; }
.app-layout { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: calc(100vh - 124px); }
.app-sidebar { display: flex; flex-direction: column; gap: 24px; min-height: 100%; padding: 24px 16px; background: var(--nav-bg); border: 0; color: var(--nav-ink); }
.hub-sidebar-brand { display: flex; align-items: center; min-height: 40px; margin: 0 8px; }
.hub-sidebar-brand img { display: block; width: 164px; max-height: 32px; object-fit: contain; object-position: left center; }
.hub-sidebar-brand-icon { display: none !important; width: 32px !important; height: 32px; }
.app-sidebar .auth { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; width: 100%; max-width: none; margin: 0; padding: 12px 8px; border: 0; border-top: 1px solid var(--nav-line); border-bottom: 1px solid var(--nav-line); background: transparent; color: var(--nav-ink); font-size: 13px; }
.app-sidebar .auth a,
.app-sidebar .auth button { color: var(--nav-ink); font: inherit; }
.app-sidebar .auth form { margin: 0; }
.app-sidebar .auth button { padding: 4px; border: 0; background: transparent; cursor: pointer; }
.app-sidebar .auth strong { font-weight: 400; }
.hub-auth-name { overflow: hidden; color: var(--nav-ink); text-overflow: ellipsis; white-space: nowrap; }
.has-sidebar-layout > .hub-auth .hub-auth-name { text-decoration: none; }
.has-sidebar-layout > .hub-auth .hub-auth-name:hover { color: var(--brand-ink); text-decoration: underline; }
.hub-sidebar-controls { display: grid; gap: 8px; }
.app-building-select-label { color: var(--nav-ink-muted); font-size: 11px; font-weight: 400; letter-spacing: .12em; text-transform: uppercase; }
.app-building-select { width: 100%; min-height: var(--control-md); padding: 8px 32px 8px 12px; border: 1px solid var(--nav-line); border-radius: var(--radius-sm); background: var(--nav-active); color: var(--nav-ink); font: 400 13px/20px var(--font-sans); }
.app-sidebar-menu { display: grid; align-content: start; gap: 4px; }
.app-sidebar-menu a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--nav-ink-muted); font-size: 14px; font-weight: 400; line-height: 20px; text-decoration: none; transition: background-color 150ms ease, color 150ms ease; }
.app-sidebar-menu a:hover { background: var(--nav-active); color: var(--nav-ink); }
.app-sidebar-menu a.selected { background: var(--nav-active); color: var(--nav-ink); }
.app-sidebar-menu a.selected .app-sidebar-icon { color: var(--nav-accent); }
.hub-profile-logout { margin: 0; }
.hub-profile-logout button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--nav-ink-muted);
    font: 400 14px/20px var(--font-sans);
    text-align: left;
    cursor: pointer;
}
.hub-profile-logout button:hover { background: var(--nav-active); color: var(--nav-ink); }
.hub-profile-logout .app-sidebar-icon { display: grid; place-items: center; font-size: 20px; }
.hub-profile-section { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.hub-profile-section h2 { margin: 0 0 20px; color: var(--heading); font-size: 20px; font-weight: 400; }
.hub-profile-details { margin: 0; }
.hub-profile-details dt { color: var(--ink-muted); font-size: 12px; }
.hub-profile-details dd { margin: 4px 0 0; color: var(--ink); font-size: 15px; }
.hub-thermostat-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.hub-thermostat-card-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px; border-bottom: 1px solid var(--line); }
.hub-thermostat-card-header .hub-overline { margin-bottom: 4px; }
.hub-thermostat-card-header h2 { margin: 0; color: var(--heading); font-size: 20px; font-weight: 400; line-height: 28px; }
.hub-thermostat-totals { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 18px; color: var(--ink-muted); font-size: 12px; }
.hub-thermostat-totals > span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.hub-thermostat-totals b { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; }
.hub-thermostat-totals .hub-thermostat-total { padding-left: 16px; border-left: 1px solid var(--line); }
.hub-thermostat-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px 0; }
.hub-thermostat-apartment-filter { appearance: none; min-width: 190px; min-height: 42px; padding: 0 34px 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%23516f64' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center / 16px; color: var(--ink); font: 400 12px/18px var(--font-sans); cursor: pointer; }
.hub-thermostat-apartment-filter:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.hub-thermostat-filters { display: flex; flex-wrap: nowrap; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-muted); }
.hub-thermostat-filter { display: inline-flex; flex: 1 1 0; align-items: center; justify-content: center; gap: 8px; min-height: 34px; padding: 0 14px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink-muted); font: 400 12px/18px var(--font-sans); white-space: nowrap; cursor: pointer; }
.hub-thermostat-filter span { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; }
.hub-thermostat-filter:hover { color: var(--ink); }
.hub-thermostat-filter.is-active { border-color: var(--line); background: var(--surface); color: var(--heading); box-shadow: 0 1px 2px rgb(20 40 30 / 8%); }
.hub-thermostat-filter.is-active span { color: var(--heading); }
.hub-thermostat-filter:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.hub-thermostat-filter-result { color: var(--ink-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.hub-thermostat-table-wrap { overflow-x: auto; padding: 12px 24px 24px; }
.hub-thermostat-table { width: 100%; min-width: 900px; border-collapse: collapse; color: var(--ink); font-size: 13px; }
.hub-thermostat-table th { padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--ink-muted); font-size: 10px; font-weight: 400; letter-spacing: .1em; text-align: left; text-transform: uppercase; white-space: normal; }
.hub-thermostat-table td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.hub-thermostat-table tbody tr:last-child td { border-bottom: 0; }
.hub-thermostat-table tbody tr:hover { background: var(--surface-muted); }
.hub-thermostat-table .is-numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hub-thermostat-name { color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; white-space: nowrap; }
.hub-thermostat-apartment { font-weight: 600; white-space: nowrap; }
.hub-thermostat-room, .hub-thermostat-target, .hub-thermostat-last-seen { color: var(--ink-muted); white-space: nowrap; }
.hub-thermostat-temperature { font-weight: 600; }
.hub-battery-cell { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.hub-battery-value { color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 600; }
.hub-battery-value.is-low { color: var(--critical); }
.hub-battery-value.is-medium { color: #C07816; }
.hub-battery-value > span { margin-left: 1px; font-size: 10px; }
.hub-battery { position: relative; display: inline-block; flex: 0 0 27px; width: 27px; height: 14px; border: 1.5px solid var(--line-strong); border-radius: 3px; }
.hub-battery-track { position: absolute; inset: 2px; overflow: hidden; border-radius: 1px; }
.hub-battery-fill { position: absolute; inset: 0 auto 0 0; max-width: 100%; border-radius: 1px; background: var(--brand); }
.hub-battery-tip { position: absolute; top: 50%; right: -4px; width: 2px; height: 6px; border-radius: 0 1px 1px 0; background: var(--line-strong); transform: translateY(-50%); }
.hub-battery--medium .hub-battery-fill { background: #D8891C; }
.hub-battery--low .hub-battery-fill { background: var(--critical); }
.hub-battery-unavailable { color: var(--ink-disabled); }
.hub-status-dot { display: inline-block; flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-disabled); }
.hub-status-dot--online { background: #2b9e68; }
.hub-status-dot--missed { background: #c28b35; }
.hub-status-dot--offline { background: #b74b37; }
.hub-device-status { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; white-space: nowrap; }
.hub-device-status--online { color: var(--positive); }
.hub-device-status--missed { color: var(--warning); }
.hub-device-status--offline { color: var(--critical); }
.hub-thermostat-empty { display: grid; justify-items: center; gap: 8px; min-height: 220px; align-content: center; padding: 32px; text-align: center; }
.hub-thermostat-empty h2, .hub-thermostat-empty h3 { margin: 0; color: var(--heading); font-size: 18px; font-weight: 400; }
.hub-thermostat-empty p { max-width: 420px; margin: 0; color: var(--ink-muted); font-size: 14px; line-height: 22px; }
.hub-thermostat-empty-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 4px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); font-size: 28px; }
.hub-thermostat-empty-filter { margin: 0; padding: 20px 24px; color: var(--ink-muted); font-size: 13px; text-align: center; }
.app-sidebar-icon { display: inline-block; flex: 0 0 20px; width: 20px; height: 20px; color: currentColor; }
.app-main { width: 100%; max-width: calc(var(--content-max) + 2 * var(--space-8)); min-width: 0; margin: 0 auto; padding: var(--space-8); background: var(--bg); }
.hub-page { display: grid; gap: var(--space-8); width: 100%; max-width: var(--content-max); margin: 0 auto; }
.hub-page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-6); }
.hub-overline { margin: 0 0 var(--space-2); color: var(--ink-muted); font-size: 11px; font-weight: 400; letter-spacing: .12em; line-height: 16px; text-transform: uppercase; }
.hub-page-title { margin: 0; color: var(--heading); font-size: 28px; font-weight: 400; letter-spacing: -.01em; line-height: 36px; }
.hub-page-description { margin: var(--space-2) 0 0; color: var(--ink-muted); font-size: 14px; font-weight: 300; line-height: 20px; }
.hub-section-heading { display: flex; align-items: center; gap: 12px; margin-bottom: var(--space-5); }
.hub-section-heading h2 { margin: 0; color: var(--ink); font-size: 20px; font-weight: 400; line-height: 28px; }
.hub-count { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: var(--radius-full); background: var(--surface-muted); color: var(--ink-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.hub-property-list { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.hub-property-row { display: flex; align-items: center; gap: 16px; min-height: var(--row-height); padding: 12px 20px; color: var(--ink); text-decoration: none; }
.hub-property-row + .hub-property-row { border-top: 1px solid var(--line); }
.hub-property-row:hover { background: var(--surface-muted); }
.hub-property-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand-ink); }
.hub-property-icon .app-sidebar-icon { width: 22px; height: 22px; flex-basis: 22px; }
.hub-property-name { display: grid; gap: 2px; min-width: 0; color: var(--ink); font-size: 15px; font-weight: 400; line-height: 22px; }
.hub-property-name small { color: var(--ink-muted); font-size: 13px; font-weight: 300; line-height: 18px; }
.hub-property-chevron { margin-left: auto; color: var(--ink-muted); }
.hub-property-action { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; color: var(--brand-ink); font-size: 13px; font-weight: 400; white-space: nowrap; }
.hub-section-heading { justify-content: space-between; align-items: flex-start; }
.hub-section-heading > div { display: grid; gap: 8px; }
.hub-section-heading .hub-page-description { margin: 0; }
.hub-property-row:hover .hub-property-action { color: var(--brand); }
.hub-empty-state { display: grid; justify-items: center; align-content: center; min-height: 420px; padding: var(--space-12); border: 1px dashed var(--line-strong); border-radius: var(--radius-md); background: var(--surface); text-align: center; }
.hub-empty-state img { object-fit: contain; margin-bottom: var(--space-5); }
.hub-empty-copy { max-width: 440px; margin: var(--space-2) 0 0; color: var(--ink-muted); font-size: 17px; font-weight: 300; line-height: 28px; }
.hub-footer { display: flex; flex-direction: row; align-items: flex-start; justify-content: space-between; gap: 24px; width: 100%; max-width: none; margin: 0; padding: 20px var(--space-8); border-top: 1px solid var(--line); background: var(--bg); color: var(--ink-muted); font-size: 12px; }
.hub-footer-branding { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.hub-footer nav { display: flex; align-items: center; gap: 20px; }
.hub-footer a { color: var(--ink-muted); text-decoration: underline; text-underline-offset: 3px; }
.hub-footer a:hover { color: var(--ink); }
.hub-footer-language { position: relative; color: var(--ink); font-size: 14px; font-weight: 400; }
.hub-footer-language summary { display: flex; min-height: 40px; align-items: center; gap: 9px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); cursor: pointer; list-style: none; }
.hub-footer-language summary::-webkit-details-marker { display: none; }
.hub-footer-language summary:hover,
.hub-footer-language[open] summary { border-color: var(--brand); }
.hub-footer-language .hub-language-chevron { width: 7px; height: 7px; margin: -4px 0 0 2px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform 140ms ease; }
.hub-footer-language[open] .hub-language-chevron { margin-top: 4px; transform: rotate(225deg); }
.hub-footer-language-options { position: absolute; z-index: 5; bottom: calc(100% + 6px); left: 0; display: grid; min-width: 160px; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 8px 24px rgb(20 45 35 / 12%); }
.hub-footer-language-options a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.hub-footer-language-options a:hover,
.hub-footer-language-options a[aria-current="true"] { background: var(--bg); }
.has-sidebar-layout .breadcrumbs,
.has-sidebar-layout .page-heading { display: none; }

@media (max-width: 1023px) {
    .app-layout { grid-template-columns: 72px minmax(0, 1fr); }
    .hub-sidebar-toggle { display: grid; margin-left: auto; }
    .app-sidebar { align-items: center; padding: 20px 8px; }
    .hub-sidebar-brand { justify-content: center; margin: 0; }
    .hub-sidebar-brand-full { display: none !important; }
    .hub-sidebar-brand-icon { display: block !important; }
    .app-sidebar .auth { justify-content: center; padding: 12px 0; }
    .app-sidebar .auth span,
    .app-sidebar .auth form,
    .hub-sidebar-controls { display: none; }
    .app-sidebar-menu { width: 100%; }
    .app-sidebar-menu a { justify-content: center; padding: 8px; }
    .app-sidebar-menu a span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .app-main { padding: var(--space-6); }
    .sidebar-open .app-layout { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
    .sidebar-open .app-sidebar { align-items: stretch; padding: 20px 16px; }
    .sidebar-open .hub-sidebar-brand { justify-content: flex-start; margin: 0 8px; }
    .sidebar-open .hub-sidebar-brand-full { display: block !important; }
    .sidebar-open .hub-sidebar-brand-icon { display: none !important; }
    .sidebar-open .app-sidebar .auth span,
    .sidebar-open .app-sidebar .auth form,
    .sidebar-open .hub-sidebar-controls { display: grid; }
    .sidebar-open .app-sidebar .auth span,
    .sidebar-open .app-sidebar .auth form { display: block; }
    .sidebar-open .app-sidebar-menu a { justify-content: flex-start; padding: 8px 12px; }
    .sidebar-open .app-sidebar-menu a span:last-child { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
}
@media (max-width: 639px) {
    body.has-sidebar-layout { grid-template-rows: 64px auto minmax(0, 1fr) auto; }
    .has-sidebar-layout > header { min-height: 64px; padding: 0 12px; }
    .has-sidebar-layout > header .logo { width: 36px; height: 36px; }
    .has-sidebar-layout > header .logo img { width: 28px; height: 28px; }
    .has-sidebar-layout > header .menu { display: none; }
    .has-sidebar-layout > header #burger:checked ~ .menu { display: flex; position: absolute; top: 64px; right: 0; left: 0; width: 100%; height: auto; padding: 8px 12px; background: var(--nav-bg); opacity: 1; }
    .has-sidebar-layout > header .menu > li > a { min-height: 44px; }
    .hub-theme-toggle { margin-left: 8px; }
    .app-layout { display: block; min-height: calc(100vh - 112px); }
    .app-sidebar { display: none; min-height: auto; padding: 16px; }
    .sidebar-open .app-sidebar { display: flex; align-items: stretch; }
    .sidebar-open .hub-sidebar-brand,
    .sidebar-open .app-sidebar .auth,
    .sidebar-open .hub-sidebar-controls { display: flex; }
    .sidebar-open .app-sidebar .auth { justify-content: space-between; }
    .app-main { padding: var(--space-4); }
    .hub-empty-state { min-height: 320px; padding: var(--space-6); }
    .hub-footer { flex-wrap: wrap; gap: 16px; padding: 20px var(--space-4); }
    .hub-property-action { font-size: 0; gap: 0; }
    .hub-property-action .hub-property-chevron { font-size: 18px; }
    .hub-thermostat-card-header { align-items: flex-start; flex-direction: column; padding: 20px 16px; }
    .hub-thermostat-totals { justify-content: flex-start; gap: 12px; }
    .hub-thermostat-toolbar { padding: 14px 16px 0; }
    .hub-thermostat-table-wrap { padding: 12px 16px 18px; }
}

[data-theme="dark"] .hub-page-title { color: var(--heading); }
[data-theme="dark"] .hub-empty-state { background: var(--surface); }

/* Editorial shell: bright header with a right-aligned menu and green active rule. */
:root[data-theme="light"] {
    --nav-bg: #f2f0e9;
    --nav-active: #dce8df;
    --nav-ink: #193f30;
    --nav-ink-muted: #58645d;
    --nav-accent: #088046;
    --nav-line: #d8d6ce;
}
.has-sidebar-layout > header {
    min-height: 76px;
    padding: 0 32px;
    border: 0;
    background: var(--surface);
}
.has-sidebar-layout > header .logo {
    width: auto;
    height: 64px;
    padding: 0;
}
.has-sidebar-layout > header .logo img {
    width: 190px;
    height: auto;
    max-height: 36px;
}
.has-sidebar-layout > header .menu { margin-left: auto; }
.has-sidebar-layout > header .menu > li > a {
    min-height: 76px;
    padding: 0 16px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: var(--nav-ink-muted);
}
.has-sidebar-layout > header .menu > li > a:hover {
    background: transparent;
    color: var(--nav-ink);
}
.has-sidebar-layout > header .menu > li > a.selected {
    border-bottom-color: var(--brand);
    background: transparent;
    color: var(--nav-ink);
    font-weight: 400;
}
.has-sidebar-layout > header .hub-theme-toggle,
.has-sidebar-layout > header .hub-sidebar-toggle {
    border-color: var(--line-strong);
    color: var(--ink);
}
.has-sidebar-layout > .hub-auth {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: none;
    min-height: 48px;
    margin: 0;
    padding: 8px 32px;
    border: 0;
    background: var(--surface);
    color: var(--ink);
}
.has-sidebar-layout > .hub-auth .hub-auth-user {
    display: flex;
    align-items: center;
    gap: 12px;
}
.has-sidebar-layout > .hub-auth .hub-auth-avatar {
    display: grid;
    flex: 0 0 32px;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #b5e8d2;
    color: #173d30;
    font-size: 12px;
    font-weight: 600;
}
.has-sidebar-layout > .hub-auth .hub-auth-name {
    max-width: 240px;
    font-size: 14px;
    font-weight: 600;
}
.has-sidebar-layout > .hub-auth form { margin: 0; }
.has-sidebar-layout > .hub-auth form button {
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    cursor: pointer;
}
.has-sidebar-layout > .hub-auth .hub-theme-toggle {
    flex: 0 0 40px;
    margin-left: auto;
    border-color: var(--line-strong);
    color: var(--ink);
}
.hub-theme-icon { width: 20px; height: 20px; }
:root:not([data-theme="dark"]) .hub-theme-icon--sun { display: none; }
:root[data-theme="dark"] .hub-theme-icon--moon { display: none; }
.app-building-select-wrap { position: relative; }
.app-building-select-icon {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 12px;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    color: var(--brand-ink);
    pointer-events: none;
    transform: translateY(-50%);
}
.app-building-select-icon .app-sidebar-icon { width: 20px; height: 20px; }
.app-building-select {
    min-height: 60px;
    padding-left: 42px;
    border-color: var(--line);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    color: var(--ink);
    font-size: 14px;
}
:root[data-theme="dark"] .has-sidebar-layout > header .logo img {
    filter: brightness(0) invert(1);
}
@media (max-width: 760px) {
    .has-sidebar-layout > .hub-auth { padding: 8px 12px; }
    .has-sidebar-layout > header .logo { width: auto; }
    .has-sidebar-layout > header .logo img { width: 152px; max-height: 32px; }
}
/* Hub application components */
.hub-site { color-scheme: light; }
[data-theme="dark"] .hub-site { color-scheme: dark; }
.hub-page { max-width: var(--content-max); margin: 0 auto; }
.hub-page-header { align-items: flex-start; gap: var(--space-6); flex-wrap: wrap; }
.hub-site h2 { font: 400 20px/1.4 var(--font-sans); color: var(--heading); margin: 0 0 20px; }
.hub-site h3 { font: 400 16px/1.5 var(--font-sans); color: var(--ink); }
.hub-site p { line-height: 1.65; }
.hub-site .page-content { width: 100%; max-width: none; margin: 0; }
.hub-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: var(--space-6); margin-bottom: var(--space-6); }
.hub-card { padding: var(--space-6); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); margin-bottom: var(--space-6); min-width: 0; }
.hub-grid > .hub-card { margin-bottom: 0; }
.hub-card p { color: var(--ink-muted); margin: 0 0 20px; }
.hub-card hr { border: 0; border-top: 1px solid var(--line); margin: var(--space-6) 0; }
.hub-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border: 1px solid var(--brand); border-radius: var(--radius-sm); background: var(--brand); color: var(--on-brand); font: 400 14px/1.5 var(--font-sans); text-decoration: none; cursor: pointer; white-space: normal; text-align: center; }
.hub-button:hover { background: var(--brand-hover); color: var(--on-brand); }
.hub-button-secondary { border-color: var(--line-strong); color: var(--ink); background: var(--surface); }
.hub-button-secondary:hover { background: var(--surface-muted); color: var(--ink); }
.hub-button:disabled { cursor: wait; opacity: .6; }
.hub-site :is(button,a,input,select,textarea,summary):focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.hub-form { display: grid; gap: 20px; max-width: 560px; }
.hub-improve-row { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.hub-improve-row .hub-field { flex: 1; min-width: 220px; }
.hub-improve-dialog { width: min(900px, calc(100vw - 32px)); max-height: 85vh; padding: 24px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); color: var(--ink); background: var(--surface); }
.hub-improve-dialog::backdrop { background: rgb(0 0 0 / 45%); }
.hub-improve-dialog h2 { margin-top: 0; }
.hub-improve-dialog__columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hub-improve-dialog__columns section { min-width: 0; }
.hub-improve-dialog__columns h3 { font-size: 15px; }
.hub-improve-dialog__columns pre { min-height: 140px; max-height: 50vh; overflow: auto; padding: 12px; white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font: inherit; }
.hub-improve-dialog__actions { justify-content: flex-end; margin-top: 16px; }
.hub-form-row { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
.hub-field { display: grid; gap: 8px; color: var(--ink); font: 400 14px/1.5 var(--font-sans); }
.hub-field :is(input,select,textarea) { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--ink); background: var(--surface); font: 400 14px/1.5 var(--font-sans); box-sizing: border-box; }
.hub-field textarea { resize: vertical; }
.hub-form > .hub-button { justify-self: start; }
.hub-check { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.hub-check input { width: 20px; height: 20px; accent-color: var(--brand); }
.hub-hint { color: var(--ink-muted); font-size: 12px; }
.hub-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 12px 0; }
.hub-notice,.hub-inline-notice { border: 1px solid var(--line); border-left: 3px solid var(--brand); background: var(--surface-muted); color: var(--ink); padding: 16px 20px; border-radius: var(--radius-sm); margin: 0 0 24px; line-height: 1.6; }
.hub-notice[hidden] { display: none; }
.hub-notice.is-error { border-left-color: var(--critical); color: var(--critical); }
.hub-table-wrap { overflow-x: auto; }
.hub-table { border-collapse: collapse; width: 100%; margin: 0; font-size: 14px; color: var(--ink); }
.hub-table :is(th,td) { padding: 14px 16px; text-align: left; border: 0; border-bottom: 1px solid var(--line); vertical-align: top; background: transparent; }
.hub-table th { color: var(--ink-muted); font-weight: 400; background: var(--surface-muted); }
.hub-table tr:hover td { background: var(--surface-muted); }
.hub-table td small { display: block; margin-top: 4px; color: var(--ink-muted); }
.hub-table .hub-button { min-height: 32px; padding: 6px 12px; }
.hub-table .hub-actions { margin: 0; }
.hub-badge { display: inline-flex; padding: 5px 10px; border-radius: var(--radius-xs); background: var(--surface-muted); color: var(--ink); font-size: 12px; font-weight: 400; white-space: nowrap; }
.hub-badge-ok,.hub-badge-finished,.hub-badge-answered { background: var(--positive-soft); color: var(--positive); }
.hub-badge-new,.hub-badge-warning,.hub-badge-in_progress,.hub-badge-read { background: var(--warning-soft); color: var(--warning); }
.hub-badge-fault,.hub-badge-offline,.hub-badge-defect { background: var(--critical-soft); color: var(--critical); }
.hub-empty { display: grid; justify-items: center; text-align: center; padding: 32px 16px; gap: 12px; }
.hub-empty h2,.hub-empty p { margin: 0; max-width: 480px; }
.hub-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.hub-tabs a { padding: 10px 12px; color: var(--ink-muted); text-decoration: none; border-bottom: 2px solid transparent; }
.hub-tabs a[aria-current] { color: var(--brand-ink); border-color: var(--brand); }
.hub-tabs span { margin-left: 6px; font-size: 12px; }
.hub-shortcuts { display: flex; flex-wrap: wrap; gap: 12px; }
.hub-faq { padding: 16px 0; border-bottom: 1px solid var(--line); }
.hub-faq summary { cursor: pointer; color: var(--ink); font-weight: 400; }
.hub-faq p { margin: 16px 0 0; }
.hub-thread { display: grid; gap: 20px; margin: 24px 0 32px; }
.hub-message { width: min(90%,800px); background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 20px 24px; }
.hub-message.is-own { justify-self: end; background: var(--surface-muted); border-radius: 16px 16px 4px 16px; }
.hub-message-meta { display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; color: var(--ink-muted); font-size: 12px; margin-bottom: 12px; }
.hub-message-meta strong { color: var(--brand-ink); font-weight: 400; }
.hub-message-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; font-size: 15px; }
.hub-attachments { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.hub-attachments a { display: grid; gap: 6px; max-width: 200px; font-size: 12px; color: var(--brand-ink); }
.hub-attachments img { max-width: 200px; height: 100px; object-fit: cover; border-radius: 8px; }
.hub-details { margin: 0 0 24px; }
.hub-details > div { display: flex; gap: 20px; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.hub-details dt { color: var(--ink-muted); font-size: 14px; }
.hub-details dd { margin: 0; font-weight: 400; overflow-wrap: anywhere; }
.hub-toolbar { display: flex; gap: 16px; align-items: end; flex-wrap: wrap; margin-bottom: 24px; }
.hub-toolbar .hub-field { flex: 1; max-width: 500px; }
.hub-kpis { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 24px; }
.hub-kpis h2 { color: var(--ink-muted); font-size: 14px; margin-bottom: 16px; }
.hub-kpi-value { font: 300 36px/1.2 var(--font-sans); color: var(--heading); }
.hub-health-list { padding: 0; list-style: none; margin: 0 0 24px; }
.hub-health-list li { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 10px 0; }
.hub-code { padding-top: 16px; }
.hub-code strong { font: 400 22px/1.5 monospace; letter-spacing: 2px; }
.hub-qr { width: 128px; height: 128px; background: var(--cg-logo-white); border: 8px solid var(--cg-logo-white); }
.hub-skeleton { height: 240px; border-radius: 16px; background: var(--surface-muted); }
.hub-address { font-size: 18px; }
.hub-list { padding-left: 24px; line-height: 1.8; }
@media(max-width:900px) { .hub-grid { grid-template-columns: 1fr; } .hub-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; } }
@media(max-width:639px) { .hub-card { padding: 20px 16px; } .hub-message { width: 100%; padding: 16px; box-sizing: border-box; } .hub-page-title { font-size: 28px; } .hub-button { min-height: 44px; } .hub-kpis .hub-card { padding: 16px; } .hub-form-row { grid-template-columns: 1fr; } .hub-improve-dialog__columns { grid-template-columns: 1fr; } }
.hub-message-body { white-space: normal; }
.hub-message-body p { color: var(--ink); margin: 0 0 12px; }
.hub-message-body > :last-child { margin-bottom: 0; }
.hub-message-body a { color: var(--brand-ink); }
.hub-message-body :is(pre,code) { background: var(--surface-muted); border-radius: 4px; }
.hub-message-body pre { padding: 12px; overflow-x: auto; }
.hub-message-body img { max-width: 100%; }
/* Grid items must be allowed to shrink below a table's intrinsic width. */
.hub-site > *, .hub-site .app-layout, .hub-site .app-main, .hub-site .hub-page, #hub-content { min-width: 0; }
.hub-site .app-layout { width: 100%; }
.hub-site .hub-page { grid-template-columns: minmax(0,1fr); }
.hub-card > .hub-button { margin: 0 8px 8px 0; }
@media(max-width:639px) {
 .has-sidebar-layout > header { min-height: 64px; padding: 0 16px; }
 .has-sidebar-layout > header > label[for="burger"] { position: static; margin: 0 12px 0 0; width: 28px; height: 28px; }
 .has-sidebar-layout > header .logo { margin-right: auto; }
 .has-sidebar-layout > header .hub-sidebar-toggle { flex: 0 0 40px; }
 .hub-site .app-sidebar .hub-sidebar-controls { display: grid; }
 .hub-site .app-sidebar-menu { grid-template-columns: 1fr; }
 .hub-site .hub-sidebar-controls form { width: 100%; min-width: 0; }
 .has-sidebar-layout > header #burger:checked ~ .menu { top: 64px; flex-wrap: wrap; justify-content: flex-start; }
}
@media(max-width:639px) {
 body.has-sidebar-layout.sidebar-open { grid-template-rows: auto auto minmax(0,1fr) auto; }
 .has-sidebar-layout.sidebar-open > header { flex-wrap: wrap; }
 .has-sidebar-layout.sidebar-open > header .menu { display: flex; order: 3; position: static; flex-wrap: wrap; justify-content: flex-start; width: 100%; height: auto; margin: 0; padding: 4px 0 12px; opacity: 1; }
 .has-sidebar-layout > header .menu > li > a { min-height: 44px; padding: 8px 10px; }
}
body.hub-site:not(.has-sidebar-layout) .hub-theme-toggle { justify-self: center; color: var(--ink); border-color: var(--line-strong); margin: 16px 0 0; }
[data-theme="dark"] .hub-login-logo { filter: brightness(0) invert(1); }
