/* House workspace: existing canvas/model, one selection tool, chat as authoring surface. */
body.house-workspace {
    --house-chat: 364px;
    --house-header: 60px;
    --house-viewbar: 60px;
    --house-footer: 28px;
    --house-ink: #243b35;
    --house-muted: #74847e;
    --house-line: #e5ebe7;
    --house-green: #28775b;
    background: #fff;
    color: var(--house-ink);
    font: 14px/1.5 system-ui, -apple-system, sans-serif;
}
#houseLoading { position: fixed; inset: 0; display: grid; place-items: center; padding: 32px; text-align: center; background: white; color: #52675d; z-index: 200; font: 14px/1.7 system-ui; }
body.house-workspace #toolbar,
body.house-workspace #sidebar,
body.house-workspace #sidebarScrim,
body.house-workspace #statusbar,
body.house-workspace #drawingCoach,
body.house-workspace #precisionBar,
body.house-workspace #overflowMenu,
body.house-workspace #mobileDraftActions,
body.house-workspace #aiShapeWorkspace,
body.house-workspace #cadFeaturesPanel,
body.house-workspace #bimEditOverlay,
body.house-workspace #bimDashboard,
body.house-workspace #modelContextBar,
body.house-workspace .bim-3d-toolbar { display: none !important; }

.house-header { height: var(--house-header); position: fixed; inset: 0 0 auto; z-index: 110; border-bottom: 1px solid var(--house-line); background: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; gap: 12px; }
.house-brand { color: var(--house-green); text-decoration: none; display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 650; letter-spacing: -.4px; }
.house-brand svg { width: 27px; height: 27px; }
.house-brand span { margin-left: 18px; padding-left: 22px; border-left: 1px solid var(--house-line); color: var(--house-muted); font-size: 13px; font-weight: 450; letter-spacing: 0; }
.house-project { display: flex; align-items: center; gap: 22px; }
body.house-workspace #localSaveStatus { color: var(--house-muted); font-size: 11px; white-space: nowrap; background: none; border: 0; padding: 0; }
#houseProjectMenu { position: relative; }
#houseProjectMenu summary { cursor: pointer; font-size: 13px; padding: 7px 13px; border: 1px solid var(--house-line); border-radius: 7px; }
#houseProjectActions { position: absolute; top: calc(100% + 8px); right: 0; width: 190px; padding: 6px; background: white; border: 1px solid var(--house-line); box-shadow: 0 8px 25px #213a3014; border-radius: 10px; }
#houseProjectActions button { display: block; width: 100%; padding: 10px 12px; color: var(--house-ink); background: white; border: 0; text-align: left; border-radius: 5px; font: 13px system-ui; cursor: pointer; }
#houseProjectActions button:hover { background: #f0f6f2; }

.house-viewbar { position: fixed; z-index: 50; top: var(--house-header); left: var(--house-chat); right: 0; height: var(--house-viewbar); display: flex; align-items: center; gap: 18px; padding: 0 24px; border-bottom: 1px solid var(--house-line); background: #fff; }
.house-viewbar button { color: var(--house-muted); border: 0; background: none; cursor: pointer; font: 12px/1.3 system-ui; min-height: 32px; border-radius: 6px; }
.house-viewbar button:hover { background: #f1f6f3; }
.house-view-tabs { display: flex; background: #f2f5f3; padding: 3px; border-radius: 8px; }
.house-view-tabs button { padding: 6px 18px; }
.house-view-tabs button[aria-pressed="true"] { color: var(--house-ink); background: white; box-shadow: 0 1px 3px #263e3212; font-weight: 600; }
.house-viewbar .house-select { color: var(--house-green); display: flex; align-items: center; gap: 6px; }
.house-select svg { width: 18px; height: 18px; }
.house-history { display: flex; gap: 4px; border-left: 1px solid var(--house-line); padding-left: 12px; }
.house-history-button { width: 32px; display: grid; place-items: center; }
.house-history-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; }
.house-viewbar button:disabled { opacity: .35; cursor: not-allowed; }
.house-viewbar .house-fit { margin-left: auto; white-space: nowrap; }

body.house-workspace.focused-start #canvas2d,
body.house-workspace.focused-start #canvas3d {
    position: fixed; top: calc(var(--house-header) + var(--house-viewbar)); left: var(--house-chat);
    width: calc(100vw - var(--house-chat)); height: calc(100dvh - var(--house-header) - var(--house-viewbar) - var(--house-footer));
    bottom: auto; right: 0; cursor: default;
}
.house-view-footer { position: fixed; bottom: 0; left: var(--house-chat); right: 0; height: var(--house-footer); background: #fff; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px; color: var(--house-muted); border-top: 1px solid var(--house-line); font-size: 10px; z-index: 20; }
.house-empty { position: fixed; top: calc(50% + 20px); left: calc(var(--house-chat) + (100vw - var(--house-chat))/2); transform: translate(-50%, -50%); text-align: center; pointer-events: none; z-index: 5; color: var(--house-muted); background: #fffffff2; padding: 24px 30px; border-radius: 12px; width: max-content; max-width: calc(100vw - var(--house-chat) - 32px); }
.house-empty svg { width: 56px; height: 56px; color: #8caf9b; margin-bottom: 14px; }
.house-empty strong { display: block; color: #52675d; font-size: 17px; font-weight: 500; margin-bottom: 8px; }
.house-empty p { font-size: 13px; line-height: 1.8; }

body.house-workspace .ai-studio { top: var(--house-header); left: 0; right: auto; bottom: 0; width: var(--house-chat); height: auto; border: 0; border-right: 1px solid var(--house-line); border-radius: 0; box-shadow: none; color: var(--house-ink); font: 13px/1.6 system-ui; background: white; }
body.house-workspace .ai-studio-header { padding: 24px 24px 18px; background: white; border: 0; }
body.house-workspace .ai-studio-header strong { font-size: 19px; font-weight: 550; letter-spacing: -.4px; }
body.house-workspace .ai-studio-header small { margin-top: 5px; font-size: 12px; color: var(--house-muted); }
body.house-workspace #aiStudioToggle { display: none; }
body.house-workspace .ai-studio-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
body.house-workspace .ai-studio-messages { padding: 8px 24px 24px; gap: 20px; user-select: text; }
body.house-workspace .ai-studio-message { padding: 0; border-radius: 0; background: none; font-size: 13px; line-height: 1.85; }
body.house-workspace .ai-studio-message.user { padding: 11px 15px; border-radius: 12px 12px 3px 12px; background: #edf5ef; color: #355344; }
body.house-workspace .ai-studio-message.error { padding: 10px 12px; color: #a43737; background: #fff3f1; border-radius: 8px; }
body.house-workspace .ai-studio-messages { min-height: 80px; scrollbar-width: thin; }
body.house-workspace .ai-studio-messages > * { flex-shrink: 0; }
body.house-workspace .ai-studio-ai-offer { width: 100%; max-width: 100%; box-sizing: border-box; padding: 14px; border: 1px solid #d9e8df; border-radius: 12px; background: #f5faf6; white-space: normal; }
.ai-studio-ai-offer strong { font-size: 14px; }
.ai-studio-ai-offer p { margin: 7px 0; line-height: 1.65; }
.ai-studio-ai-offer small { display: block; color: #74847e; font-size: 10px; line-height: 1.6; }
.ai-studio-ai-offer a { color: var(--house-green); }
body.house-workspace .ai-studio-ai-offer .ai-studio-actions { flex-wrap: wrap; }
.ai-studio-disable-ai { border: 1px solid #d9e8df; background: white; color: var(--house-ink); border-radius: 6px; padding: 8px 12px; cursor: pointer; }
.ai-studio-mode { display: flex; align-items: center; justify-content: space-between; padding: 8px 20px; border-top: 1px solid var(--house-line); font-size: 11px; flex-shrink: 0; }
.ai-studio-mode button { border: 0; background: none; padding: 4px 0; font: inherit; color: var(--house-muted); cursor: pointer; }
.ai-studio-mode button[aria-pressed="true"] { color: var(--house-green); }
.ai-studio-mode a { color: var(--house-muted); text-decoration: none; }
body.house-workspace #aiStudioForm, body.house-workspace .ai-studio-examples,
body.house-workspace .ai-studio-preview, body.house-workspace .house-selection { flex-shrink: 0; }
body.house-workspace .ai-studio-preview { margin: 0 18px 12px; padding: 12px; border: 1px solid #d8e8dc; border-radius: 9px; background: #f6faf6; }
body.house-workspace .ai-studio-actions button { font: 11px/1.5 system-ui; padding: 9px 10px; border-color: var(--house-line); }
body.house-workspace .ai-studio .ai-studio-primary { background: var(--house-green); font: 12px/1.5 system-ui; padding: 9px 13px; }
body.house-workspace .ai-studio .ai-studio-primary:hover { background: #205f49; }
body.house-workspace .ai-studio-examples { gap: 7px; padding: 0 20px 12px; }
body.house-workspace .ai-studio-examples button { font: 11px/1.5 system-ui; padding: 6px 9px; border: 1px solid var(--house-line); border-radius: 6px; color: #687d70; }
body.house-workspace .ai-studio-examples button:hover { border-color: #90b49c; background: #f7faf8; }
body.house-workspace #aiStudioForm { padding: 0 18px 14px; }
body.house-workspace #aiStudioInput { min-height: 88px; max-height: 160px; resize: none; padding: 12px; border-color: #d8e2dc; border-radius: 10px; color: var(--house-ink); font-size: 13px; line-height: 1.6; box-shadow: 0 2px 5px #263e3205; }
body.house-workspace #aiStudioInput:focus { outline: 2px solid #b4d5bf; outline-offset: 1px; }
body.house-workspace #aiStudioInput::placeholder { color: #98a59d; }
body.house-workspace #aiStudioStatus { font-size: 10px; color: var(--house-muted); }
body.house-workspace .ai-studio-notice { padding: 9px 20px; font-size: 10px; line-height: 1.7; color: var(--house-muted); border-color: var(--house-line); }
.ai-studio-notice summary { cursor: pointer; }
.ai-studio-notice p { padding-top: 8px; }
.ai-studio-notice input { vertical-align: middle; accent-color: var(--house-green); }
.house-selection { display: flex; align-items: center; gap: 8px; margin: 0 20px 12px; padding: 8px 10px; border-left: 2px solid #86b897; background: #f4f8f4; font-size: 11px; color: #4c7358; }
.house-selection button { margin-left: auto; cursor: pointer; border: 0; background: transparent; color: inherit; font-size: 19px; }
body.house-workspace button:focus-visible, body.house-workspace summary:focus-visible { outline: 2px solid #78a98e; outline-offset: 2px; }
body.house-workspace #editorToast { left: calc(var(--house-chat) + 20px); right: 20px; top: auto; bottom: 92px; max-width: 420px; transform: none; pointer-events: none; }
.house-navigation { position: fixed; right: 18px; bottom: calc(var(--house-footer) + 18px); z-index: 45; display: flex; align-items: center; gap: 8px; color: var(--house-ink); }
.house-navigation summary, .house-zoom { border: 1px solid #dce5df; border-radius: 10px; box-shadow: 0 3px 14px #263e3209; background: #ffffffed; }
.house-navigation summary { padding: 9px 14px; cursor: pointer; font-size: 12px; list-style: none; }
.house-navigation summary::-webkit-details-marker { display: none; }
.house-zoom { display: flex; align-items: center; padding: 2px; }
.house-zoom button { width: 36px; height: 34px; border: 0; border-radius: 7px; background: none; font: 21px system-ui; color: var(--house-ink); cursor: pointer; }
.house-zoom button:hover { background: #edf5ef; }
#houseZoomValue { min-width: 43px; text-align: center; font-size: 11px; color: var(--house-muted); }
.house-view-menu { position: absolute; right: 0; bottom: calc(100% + 9px); width: 220px; padding: 7px; border: 1px solid var(--house-line); border-radius: 12px; background: white; box-shadow: 0 8px 30px #263e3218; }
.house-view-menu button { display: block; width: 100%; padding: 10px 9px; border: 0; border-radius: 6px; text-align: left; background: none; color: var(--house-ink); font: 12px system-ui; cursor: pointer; }
.house-view-menu button:hover { background: #edf5ef; }
.house-view-menu button:disabled { opacity: .4; cursor: default; }
.house-view-menu p { padding: 8px 9px 4px; margin: 5px 0 0; border-top: 1px solid var(--house-line); font-size: 10px; line-height: 1.8; color: var(--house-muted); }

@media (max-width: 760px) {
    body.house-workspace { --house-chat: 0px; --house-header: 52px; --house-viewbar: 48px; --house-bottom: 47dvh; --house-footer: 0px; }
    .house-header { padding: 0 14px; }
    .house-brand { font-size: 15px; }
    .house-brand span { display: none; }
    .house-project { gap: 10px; }
    body.house-workspace #localSaveStatus { font-size: 9px; }
    .house-viewbar { padding: 0 12px; gap: 10px; }
    .house-view-tabs button { padding: 5px 13px; }
    .house-select span { display: none; }
    .house-history { padding-left: 6px; gap: 0; }
    .house-viewbar .house-fit { font-size: 11px; }
    body.house-workspace.focused-start #canvas2d,
    body.house-workspace.focused-start #canvas3d { height: calc(100dvh - var(--house-header) - var(--house-viewbar) - var(--house-bottom)); }
    .house-view-footer { display: none; }
    body.house-workspace .ai-studio { top: auto; bottom: 0; width: 100%; height: var(--house-bottom); border-right: 0; border-top: 1px solid var(--house-line); padding-bottom: env(safe-area-inset-bottom, 0px); }
    body.house-workspace .ai-studio-header { padding: 10px 16px; border-bottom: 1px solid var(--house-line); }
    body.house-workspace .ai-studio-header strong { font-size: 14px; }
    body.house-workspace .ai-studio-header small { display: none; }
    body.house-workspace #aiStudioToggle { display: block; border-color: var(--house-line); width: 28px; height: 28px; }
    body.house-workspace .ai-studio-messages { padding: 10px 16px; gap: 12px; }
    body.house-workspace .ai-studio-message { font-size: 12px; line-height: 1.7; }
    body.house-workspace #aiStudioInput { min-height: 54px; height: 54px; font-size: 16px; padding: 8px 10px; }
    body.house-workspace #aiStudioForm { padding: 0 12px 8px; }
    body.house-workspace .ai-studio-examples { flex-wrap: nowrap; overflow-x: auto; flex-shrink: 0; padding: 0 12px 8px; }
    body.house-workspace .ai-studio-examples button { white-space: nowrap; font-size: 10px; padding: 4px 7px; }
    body.house-workspace .ai-studio-notice { padding: 5px 12px; font-size: 9px; }
    body.house-workspace .ai-studio-form-footer { margin-top: 4px; }
    body.house-workspace .ai-studio-preview { margin: 0 12px 8px; padding: 8px; font-size: 11px; }
    body.house-workspace .house-selection { margin: 0 12px 6px; padding: 4px 8px; }
    .house-empty { top: calc((100dvh - var(--house-bottom) + var(--house-header) + var(--house-viewbar))/2); padding: 12px; }
    .house-empty svg { width: 38px; height: 38px; margin-bottom: 6px; }
    .house-empty strong { font-size: 14px; }
    .house-empty p { font-size: 11px; }
    body.house-workspace.house-chat-collapsed { --house-bottom: 50px; }
    body.house-workspace .ai-studio.collapsed { height: var(--house-bottom); }
    body.house-workspace #editorToast { bottom: calc(var(--house-bottom) + 58px); left: 12px; right: 12px; }
    .house-navigation { right: 12px; bottom: calc(var(--house-bottom) + 12px); gap: 6px; }
    .house-navigation summary { padding: 8px 12px; }
    .house-zoom button { height: 30px; width: 32px; }
    .ai-studio-mode { padding: 4px 14px; font-size: 10px; }
    body.house-workspace .ai-studio-messages { min-height: 40px; }
    body.house-workspace:not(.house-chat-collapsed):has(#aiStudioPreview:not([hidden])) { --house-bottom: min(60dvh, 480px); }
    body.house-workspace:not(.house-chat-collapsed):has(.ai-studio-ai-offer) { --house-bottom: min(65dvh, 500px); }
    body.house-workspace:has(#aiStudioPreview:not([hidden])) .ai-studio-examples { display: none; }
    body.house-workspace:has(.ai-studio-ai-offer) .ai-studio-examples { display: none; }
    body.house-workspace .ai-studio-ai-offer { padding: 12px; }
}

@media (max-height: 650px) and (min-width: 761px) {
    body.house-workspace .ai-studio-header { padding-top: 14px; padding-bottom: 10px; }
    body.house-workspace .ai-studio-messages { padding-bottom: 14px; }
    body.house-workspace #aiStudioInput { min-height: 60px; height: 60px; }
}

#houseDimensionEditor { position: fixed; z-index: 62; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; width: 224px; padding: 10px; border: 1px solid #86b897; border-radius: 10px; background: #fff; box-shadow: 0 5px 20px #263e3220; color: #243b35; font: 11px/1.4 system-ui; }
#houseDimensionEditor[hidden] { display: none; }
#houseDimensionEditor label { display: grid; gap: 3px; flex: 1; }
#houseDimensionValue { width: 125px; min-width: 0; min-height: 34px; padding: 4px 7px; border: 1px solid #c3d8cb; border-radius: 6px; color: #243b35; background: white; font: 16px system-ui; }
#houseDimensionEditor button { width: 31px; height: 34px; margin-top: 15px; border: 0; border-radius: 6px; background: #edf5ef; color: #28775b; cursor: pointer; font: 18px system-ui; }
#houseDimensionEditor button[type=submit] { color: white; background: #28775b; }
#houseDimensionEditor small { flex-basis: 100%; color: #a43737; font-size: 10px; }
#houseDimensionEditor small:empty { display: none; }
#houseDimensionEditor .dimension-bind { flex-basis: 100%; width: auto; height: auto; margin-top: 2px; padding: 7px 9px; font: 11px system-ui; }
#houseDimensionEditor .dimension-bind[hidden] { display: none; }
#houseDimensionEditor button:disabled { opacity: .45; cursor: default; }
#houseDimensionEditor.binding label, #houseDimensionEditor.binding button[type=submit], #houseDimensionEditor.binding .dimension-bind { display: none; }
#houseDimensionEditor.binding small { order: -1; flex: 1; color: #28775b; }
#houseDimensionEditor.binding .dimension-cancel { margin-top: 0; }
.house-level-navigation{display:flex;align-items:center;gap:12px;margin-left:auto;font-size:12px;color:var(--house-muted,#657d77)}
.house-level-navigation label{display:flex;align-items:center;gap:6px;white-space:nowrap}
.house-level-navigation select{max-width:150px;border:1px solid #d8e4df;border-radius:8px;background:#fff;padding:6px;color:#244e40;font:inherit}
.house-level-navigation details{position:relative}.house-level-navigation summary{cursor:pointer;white-space:nowrap}
.house-level-navigation details[open]{z-index:55}.house-level-navigation details>div,.house-level-navigation details>p{background:#fff}
.house-level-navigation details>div{position:absolute;right:0;top:28px;width:280px;max-height:260px;overflow:auto;padding:12px;border:1px solid #d8e4df;border-radius:12px;box-shadow:0 8px 28px #214c3b18}
.house-level-navigation details>p{position:absolute;right:0;top:302px;width:280px;margin:0;padding:10px 12px;border:1px solid #d8e4df;border-radius:8px;line-height:1.5}
.house-level-row{display:flex;justify-content:space-between;gap:16px;padding:7px 0;border-bottom:1px solid #edf2ef}.house-level-row strong{white-space:nowrap;font-weight:500;color:#244e40}
@media(max-width:700px){.house-level-navigation{gap:8px}.house-level-navigation label{font-size:0}.house-level-navigation select{font-size:12px;max-width:92px}.house-level-navigation details>div{width:245px}.house-level-navigation details>p{width:245px}}

@media(max-width:700px){.house-level-navigation{position:fixed;top:calc(var(--house-header) + var(--house-viewbar) + 8px);right:12px;background:#fffffff2;border:1px solid #d8e4df;border-radius:10px;padding:5px 9px;z-index:52}.house-level-navigation label{font-size:0}}
.house-inspection-options{border-top:1px solid #e2eae6;margin-top:8px;padding-top:10px;display:grid;gap:10px;font-size:12px;max-height:48dvh;overflow:auto}
.house-inspection-options label{display:flex;align-items:center;gap:8px;line-height:1.4}.house-inspection-options select,.house-inspection-options input[type=number]{border:1px solid #d8e4df;border-radius:6px;padding:5px;background:#fff;color:#254e40;max-width:100px}.house-inspection-options input[type=checkbox]{accent-color:#27775d}.house-inspection-options #houseDiagnostics{max-height:140px;overflow:auto;line-height:1.5}.house-inspection-options #houseDiagnostics p{margin:5px 0}
.house-view-menu{max-height:calc(100dvh - var(--house-header) - var(--house-viewbar) - 60px);overflow:auto}
@media(max-width:700px){.house-view-menu{max-height:calc(100dvh - var(--house-header) - var(--house-viewbar) - var(--house-bottom) - 60px)}}
body.house-workspace:has(#houseViewMenu[open]) .house-level-navigation{visibility:hidden}

/* The inspector edits existing objects and shares their command history. */
#houseProperties { position:fixed; top:calc(var(--house-header) + var(--house-viewbar)); right:0; bottom:var(--house-footer); width:280px; z-index:55; background:#fff; border-left:1px solid var(--house-line); box-shadow:-6px 0 24px #243b3508; overflow:auto; color:var(--house-ink); }
#houseProperties[hidden] { display:none; }
#houseProperties header { display:flex; align-items:center; justify-content:space-between; padding:16px 18px; border-bottom:1px solid var(--house-line); }
#houseProperties header button { background:none; border:0; font-size:24px; color:var(--house-muted); cursor:pointer; }
#houseProperties form { padding:16px 18px; }
.property-fields { display:grid; gap:12px; }
.property-fields label { display:grid; gap:5px; color:#61746b; font:12px/1.4 system-ui; }
.property-fields input,.property-fields select { box-sizing:border-box; width:100%; min-width:0; border:1px solid #d7e4dc; border-radius:7px; background:#fff; color:var(--house-ink); padding:9px 10px; font:14px system-ui; }
.property-fields input:focus,.property-fields select:focus { outline:2px solid #75ad90; outline-offset:1px; }
.property-summary { font-size:11px; color:var(--house-muted); line-height:1.7; border-top:1px solid var(--house-line); padding-top:12px; }
.property-error { color:#aa3e33; font-size:12px; }
#houseProperties footer { position:sticky; bottom:-16px; padding:12px 0; display:grid; gap:7px; background:white; }
#houseProperties footer button { padding:11px; border:0; border-radius:7px; color:white; background:var(--house-green); cursor:pointer; font:14px system-ui; }
#houseProperties footer button:disabled { opacity:.5; cursor:default; }
#houseProperties footer span { color:var(--house-muted); font-size:10px; text-align:center; }
@media(min-width:1101px){
 body.house-properties-open .house-navigation { right:296px; }
}
@media(max-width:760px){
 #houseProperties { top:auto; bottom:0; left:0; width:auto; max-height:50dvh; border-left:0; border-top:1px solid var(--house-line); border-radius:16px 16px 0 0; z-index:115; box-shadow:0 -6px 30px #243b351c; }
 #houseProperties header { padding:8px 16px; }
 #houseProperties form { padding:10px 16px; }
 .property-fields { grid-template-columns:1fr 1fr; gap:10px; }
 .property-summary { grid-column:1 / -1; }
 #houseProperties footer { bottom:-10px; }
}
