/* Shared viewport navigation */
.view-navigation { position:absolute; top:12px; right:12px; z-index:2; width:90px; height:94px; touch-action:none; }
.view-miniature,.view-miniature-axes { position:absolute; inset:0; pointer-events:none; }
.view-checkerboard,.view-miniature i,.view-miniature-axes i { position:absolute; left:0; top:0; transform-origin:0 0; }
.view-checkerboard { background:conic-gradient(#2e2e2e 25%,#111 0 50%,#2e2e2e 0 75%,#111 0) 0 0 / 16px 16px; }
.view-miniature i,.view-miniature-axes i { height:1.5px; }
#viewport-buttons { box-sizing:border-box; align-items:center; justify-content:flex-start; padding:0 var(--viewport-inset); bottom:var(--viewport-inset); flex-wrap:wrap; pointer-events:none; }
#viewport-buttons button { pointer-events:auto; }
#viewport-buttons #coverage-section { position:static; align-self:flex-end; margin-left:auto; border:0; padding:0; line-height:1; transform:translateY(.17em); background:transparent; color:white; text-shadow:0 1px 3px #151722; }
.config-dialog #wizard-generate,.share-dialog .share-row button { background:var(--accent-strong); border-color:var(--accent-strong); color:white; }
.config-dialog #wizard-generate:hover,.share-row button:hover { background:var(--designer-primary-hover); color:white; }
.config-dialog .config-preview header h3 { display:flex; align-items:center; gap:8px; }
.config-preview header h3 img { width:20px; height:20px; object-fit:contain; }
.preview-count-warning svg { display:block; width:16px; height:16px; padding:0; fill:none; stroke:#ffcf59; stroke-width:2; stroke-linejoin:round; stroke-linecap:round; }
.preview-summary { display:flex; align-items:center; gap:8px; }
dialog.share-dialog { width:min(450px,92vw); max-height:92vh; max-height:92dvh; overflow:auto; }
#share-link-fallback { -webkit-user-select:text; user-select:text; }
@media (pointer:coarse) {
  /* Safari zooms the page on focus when inputs are smaller than 16px. */
  #share-modal .share-row input { font-size:16px; }
  #share-modal .share-row button { min-height:44px; }
  #share-modal #close-share-modal { min-width:44px; min-height:44px; }
}
.share-body { display:grid; padding:16px var(--dialog-inset); gap:16px; }
.share-body label { font-size:13px; font-weight:600; }
.share-body form { border-top:1px solid #d0d7df; padding-top:14px; }
.share-body .share-row { display:flex; align-items:stretch; gap:8px; margin-top:6px; }
.share-row > input,.share-row .file-name { min-width:0; flex:1; border:1px solid #bdc8d4; border-radius:6px; background:white; }
.share-row input { width:100%; min-width:0; padding:7px; font:13px var(--ui-font); color:#34485d; }
.share-row .file-name { display:flex; align-items:center; padding-right:7px; color:#647489; }
.file-name input { border:0; background:transparent; }
.share-row button { display:flex; gap:6px; align-items:center; white-space:nowrap; }
.share-body p { margin-top:6px; color:#51677a; font-size:12px; }

#model-import-status:empty { display:none; }
#model-import-status,#model-storage-warning { font-size:12px; overflow-wrap:anywhere; }
.object-settings strong { overflow-wrap:anywhere; }
.config-preview header h3 img { background:#303542; border-radius:5px; padding:3px; box-sizing:border-box; }
.share-dialog .config-header { padding:8px var(--dialog-inset); }
.share-dialog #close-share-modal { display:grid; place-items:center; width:30px; height:30px; padding:0; font-size:20px; border:1px solid #c7d1db; border-radius:5px; background:transparent; line-height:1; transition:background .15s,color .15s,transform .15s; }
.share-dialog #close-share-modal:hover { color:white; background:#725083; transform:scale(1.06); }
.share-row button svg { width:16px; height:16px; flex:none; padding:0; color:inherit; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
@media(prefers-reduced-motion:reduce) { #open-wizard-button.generate-attention { animation:none; } .share-dialog #close-share-modal:hover { transform:none; } }

.config-segments .surface-option { display:flex; align-items:center; justify-content:center; gap:6px; }
/* The diagrams occupy the top 80% of the artwork. The adjacent label names each surface. */
.config-segments .surface-option img { width:46px; height:37px; flex:none; object-fit:cover; object-position:center top; filter:grayscale(1) invert(1) sepia(.8) saturate(2) hue-rotate(215deg) brightness(.95) contrast(.31); }
.preview-tracking-img { filter:sepia(.45) saturate(2.4) hue-rotate(165deg); width:38px; height:30px; padding:0; background:transparent; border-radius:0; object-fit:cover; object-position:center top; }
#wizard-generate { display:inline-flex; align-items:center; justify-content:center; gap:6px; }
#wizard-generate .main-icon { width:16px; height:16px; padding:0; }
/* Configuration wizard */
.config-dialog {
  --dialog-inset:clamp(12px, 2vw, 20px);
  --ink:#27354a; --muted:#52667b;  --edge:#cdd7df;
  box-sizing:border-box; width:min(940px,94vw); max-height:92dvh; margin:auto; padding:0;
  border:1px solid var(--edge); border-radius:14px; color:var(--ink); background:#f8fafb;
  box-shadow:0 22px 80px #121d3445; font:14px/1.45 var(--ui-font);
}
.config-dialog[open] { animation:config-enter .18s ease-out; }
.config-dialog::backdrop { background:#15213094; }
.config-dialog *, .config-dialog *::before { box-sizing:border-box; }
.config-dialog [hidden] { display:none !important; }
.config-dialog :is(h2,h3,p,fieldset,legend) { margin:0; padding:0; }
.config-dialog :is(button,select,input) { font:inherit; }
.config-dialog button,.config-dialog select { cursor:pointer; }
.config-dialog button { border:1px solid var(--edge); border-radius:6px; background:white; color:var(--ink); padding:8px 12px; transition:background .15s,color .15s,border-color .15s; }
.config-dialog button:hover { background:#e6eef5; border-color:#8da6bb; }
.config-dialog :focus-visible { outline:2px solid var(--accent-strong); outline-offset:2px; }
.config-header,.config-preview header,.config-controls footer { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.config-header { padding:12px var(--dialog-inset); border-bottom:1px solid var(--edge); }
.config-header h2 { color:var(--ink); font-size:19px; font-weight:650; }
.config-dialog #close-popup { border:0; padding:0; width:32px; height:32px; font-size:24px; line-height:1; }
.config-layout { --wizard-bar-height:40px; display:grid; grid-template-columns:minmax(275px,.88fr) minmax(280px,1.35fr); }
.config-controls { min-height:490px; display:flex; flex-direction:column; gap:16px; padding:16px var(--dialog-inset); container: wizard-controls / inline-size; }
.config-steps,.config-segments { display:flex; }
.config-steps { box-sizing:border-box; height:var(--wizard-bar-height); flex:none; border-bottom:1px solid var(--edge); }
.config-steps button { flex:1; border:0; border-bottom:2px solid transparent; border-radius:0; background:transparent; color:var(--muted); }
.config-steps button[aria-current=step] { color:var(--designer-primary-hover); border-bottom-color:var(--accent-strong); font-weight:650; }
.config-controls :is(form,section) { display:grid; gap:12px; animation:config-enter .16s ease-out; }
.config-controls fieldset { position:relative; min-width:0; border:0; }
.config-controls legend,.config-controls label { color:var(--ink); font-size:13px; font-weight:550; }
.config-controls legend { margin-bottom:6px; }
.config-controls label { display:grid; gap:4px; }
.config-fields > label { grid-template-rows:1fr auto; align-items:end; }
.config-segments { gap:3px; padding:3px; border-radius:7px; background:#e4eaf0; }
.config-segments label { flex:1; position:relative; cursor:pointer; }
.config-segments input { position:absolute; opacity:0; width:1px; height:1px; }
.config-segments span { padding:6px; border-radius:5px; text-align:center; color:var(--muted); transition:background .15s; }
.config-segments label:hover span { background:#f0f4f7; }
.config-segments input:checked + span { color:var(--designer-primary-hover); background:white; box-shadow:0 1px 3px #27354a26; }
.config-segments input:focus-visible + span { outline:2px solid var(--accent-strong); }
.config-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 12px; }
.config-controls select,.config-controls input[type=number] { width:100%; min-width:0; height:34px; padding:4px 8px; color:#365e7d; background:#fff; border:1px solid #b2c3d0; border-radius:5px; }
.config-controls #dimensions-inputs .transform-number { width:100%; max-width:none; }
.config-controls .transform-number input { padding-right:22px; }
.config-controls button.config-primary { background:var(--accent-strong); border-color:var(--accent-strong); color:white; font-weight:600; }
.config-controls button.config-primary:hover { background:var(--designer-primary-hover); }
.config-controls button:disabled { opacity:.5; cursor:default; }
.config-controls p { line-height:1.45; font-size:13px; color:var(--muted); }
#sensor-contact-note svg { width:16px; height:16px; padding:0; margin-inline-end:4px; vertical-align:text-bottom; fill:none; stroke:#926410; stroke-width:1.8; stroke-linejoin:round; }
#sensor-contact-note a { font:inherit; color:var(--designer-primary-hover); text-decoration:underline; }
.config-controls p:empty { display:none; }
.config-preview { margin:16px var(--dialog-inset) 16px 0; min-height:320px; display:grid; grid-template-rows:auto minmax(200px,1fr); overflow:hidden; border-radius:9px; background:#202733; color:#e2ebf3; }
.config-preview header { box-sizing:border-box; height:var(--wizard-bar-height); padding:0 12px; background:#28313d; }
.config-preview h3 { font-size:14px; color:inherit; }
.config-preview header span { font-size:12px; }
#wizard-canvas { position:relative; min-height:0; }
#wizard-canvas canvas { position:absolute; inset:0; width:100%; height:100%; cursor:grab; }
#wizard-canvas canvas:active { cursor:grabbing; }
.config-preview button { padding:4px 8px; background:transparent; color:#d7e6f0; border-color:#53687c; font-size:12px; }
.config-preview button:hover { background:#3b4e60; }
#add-object-button { cursor:pointer; }
@keyframes config-enter { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }
@media(max-width:680px) {
  .config-layout { grid-template-columns:minmax(0,1fr); }
  .config-controls { min-height:0; padding:12px var(--dialog-inset); }
  .config-preview { margin:0 var(--dialog-inset) 12px; min-height:200px; grid-template-rows:auto 220px; }
}
@media(prefers-reduced-motion:reduce) {
  .config-dialog[open],.config-controls :is(form,section) { animation:none; }
  .config-dialog * { transition:none !important; }
}

#wizard-unit { position:absolute; z-index:2; left:10px; bottom:8px; margin:0; width:auto; height:26px; display:inline-flex; align-items:center; gap:4px; padding:2px 6px; }
.preview-dimensions { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; overflow:hidden; }
.preview-dimensions line { stroke:#eadfff; stroke-width:1.25; }
.preview-dimensions path { fill:none; stroke:#eadfff; stroke-width:1.5; }
.preview-dimensions text { font:600 11px var(--ui-font); letter-spacing:normal; text-anchor:middle; dominant-baseline:central; fill:#fff; stroke:#202733; stroke-width:4px; stroke-linejoin:round; paint-order:stroke; }
.floor-art { position:relative; width:46px; height:37px; display:block; flex:none; }
.floor-art svg { position:absolute; inset:0; width:100%; height:100%; fill:none; stroke:#83709e; stroke-width:12px; stroke-linejoin:round; }
.preview-surface { display:inline-flex; align-items:center; gap:6px; padding:2px 9px; border-radius:6px; background:transparent; color:#f2edf9; font:550 13px var(--ui-font); }
.preview-surface .preview-surface-label { font:inherit; }
.config-segments .tracking-choice { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; font-size:12px; }
.tracking-choice svg { width:40px; height:32px; }
.preview-dimensions .dimension-witness { stroke:#a79bb9; stroke-width:1; stroke-dasharray:3 2; }

.tracking-art-defs { position:absolute; width:0; height:0; overflow:hidden; }
.tracking-art-defs,.tracking-choice svg,.floor-art svg,.preview-dimensions { padding:0; }

.preview-surface .floor-art { width:38px; height:30px; }
.preview-surface .floor-art svg { stroke:#c2aedc; }
.preview-surface .floor-art:not(.show-outline) svg { display:none; }
.config-segments .shape-option { display:flex; align-items:center; justify-content:center; gap:7px; }
.shape-option svg { width:20px; height:16px; padding:0; fill:none; stroke:#535961; stroke-width:1.8; }

#wizard-equipment .server-icon { width:64px; }
#wizard-sensor:not([hidden]) { display:flex; flex:1; flex-direction:column; gap:12px; }
#wizard-sensor > .config-fields { grid-template-columns:1fr; gap:12px; }
#wizard-sensor .tracking-choice { min-height:38px; flex-direction:row; gap:6px; font-size:13px; }
#wizard-sensor footer { margin-top:auto; }
#wizard-sensor p:empty { display:none; }

/* Base compact choices on the actual form width, including in the two-column wizard. */
@container wizard-controls (max-width: 340px) {
  .config-segments .surface-option,
  #wizard-sensor .tracking-choice { flex-direction:column; gap:4px; }
}
.config-controls footer { flex-wrap:wrap; }
.config-controls footer button { max-width:100%; overflow-wrap:anywhere; }
.config-header h2 { min-width:0; overflow-wrap:anywhere; line-height:1.3; }
.config-header > button { flex:none; }
.share-body { container: share-body / inline-size; }
@container share-body (max-width: 320px) {
  .share-body .share-row { display:grid; grid-template-columns:minmax(0,1fr); }
  .share-row button { justify-self:end; }
}
