
#library-surveys-panel{margin-top:22px;min-width:0}
.library-page[data-survey-editing="true"] :is(.library-intro,.library-format-tabs){display:none}
.library-page[data-survey-editing="true"]>.library-footer{padding-bottom:68px}
.survey-heading,.survey-editor-heading{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:16px}
.survey-heading{justify-content:space-between}
.survey-heading h2,.survey-editor-heading h2{margin:0;color:var(--ink);font-weight:600}
.survey-heading h2,.survey-editor-heading h2{font-size:clamp(19px,3vw,24px)}
.survey-editor-heading .survey-title-field{margin-left:auto;width:min(320px,100%)}
.survey-list{display:grid;gap:10px;grid-template-columns:repeat(auto-fill,minmax(min(100%,260px),1fr))}
.survey-list-card{display:flex;justify-content:space-between;align-items:center;gap:12px;min-height:58px;padding:12px 16px;background:var(--surface);border:1px solid var(--line);border-radius:9px;color:var(--ink);text-decoration:none}
.survey-list-card:hover{border-color:var(--green)}
.survey-list-card strong{min-width:0;overflow-wrap:anywhere;font-size:15px}
.survey-list-card span,.survey-status{color:var(--muted);font-size:12px;line-height:1.4}
.survey-list-card span{flex:none}
.survey-empty,.survey-hint,.survey-conflict p{margin:0;line-height:1.5;color:var(--muted);font-size:13px}
.survey-empty{padding:14px}
.survey-notice,.survey-conflict{margin:0 0 12px;padding:10px 12px;border:1px solid #dfc489;border-radius:8px;background:#fff8ea;color:#6b4517;font-size:13px;line-height:1.5;overflow-wrap:anywhere}
.survey-conflict p{color:inherit;margin-bottom:8px}
.survey-preview-card,.survey-section{min-width:0;border:1px solid var(--line);border-radius:10px;background:var(--surface)}
.survey-preview-card{position:sticky;top:12px;padding:10px}
.survey-preview{min-height:240px;min-width:0;overflow:hidden;position:relative;background:var(--soft);border-radius:7px}
.survey-preview[data-view="3d"] .survey-3d-stage{height:clamp(280px,48svh,510px)}
.survey-preview[data-view="plan"]{min-height:250px}
.survey-preview svg{display:block;width:100%;height:auto}
.survey-preview canvas{display:block;max-width:100%;touch-action:none}
#library-surveys-panel .button{min-height:44px;height:auto;padding:8px 12px;white-space:normal;line-height:1.3;text-align:center;text-decoration:none}
#library-surveys-panel :is(button,a,input,select,summary):focus-visible{outline:2px solid #538571;outline-offset:2px}
.survey-form,.survey-group{display:grid;gap:12px;min-width:0}
.survey-section>summary{display:flex;align-items:center;gap:8px;cursor:pointer;min-height:44px;padding:8px 12px;color:var(--ink);font-weight:600;font-size:14px;list-style:none}
.survey-section>summary::-webkit-details-marker{display:none}
.survey-section>summary::before{content:"";width:6px;height:6px;flex:none;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:rotate(-45deg)}
.survey-section[open]>summary::before{transform:rotate(45deg)}
.survey-section>summary+*{margin:0 12px 12px}
.survey-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.survey-field-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.survey-field{display:grid;align-content:start;gap:4px;min-width:0;color:var(--ink);font-size:13px;line-height:1.35}
.survey-field>span{overflow-wrap:anywhere}
.survey-field input,.survey-field select{width:100%;min-width:0;min-height:44px;padding:8px;border:1px solid var(--line);border-radius:7px;background:var(--surface);color:var(--ink);font:inherit;font-size:16px}
.survey-field [aria-invalid=true]{border-color:#ad4837}
.survey-field-error{color:#a43c2c;font-size:12px}
.survey-record{display:grid;gap:8px;border:1px solid var(--line);border-radius:8px;padding:10px}
.survey-record>.button{justify-self:start}
.survey-add-feature{align-items:end}
.survey-save-bar{position:sticky;z-index:6;bottom:0;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;margin-top:16px;padding:10px 12px max(10px,env(safe-area-inset-bottom));border:1px solid var(--line);border-radius:8px;background:var(--surface)}
.survey-save-bar[data-view="measure"]{position:static}
.survey-save-bar .survey-status{margin:0}
.survey-delete-link{color:#983d30}
#library-surveys-panel .survey-danger{background:#983d30;border-color:#983d30;color:#fff}
@media(max-width:820px){
  .survey-preview-card{position:static}
}
@media(max-width:500px){
  .library-page[data-survey-editing="true"] .library-intro{display:none}
  .library-page[data-survey-editing="true"]>.library-footer{padding-bottom:0}
  #library-surveys-panel{margin-top:12px}
  .survey-editor-heading{margin-bottom:12px;gap:8px}
  .survey-editor-heading .survey-title-field{width:100%;margin-left:0}
  .survey-preview[data-view="plan"]{min-height:200px}
  .survey-preview[data-view="3d"] .survey-3d-stage{height:clamp(265px,36svh,365px)}
  .survey-save-bar{position:static;margin-inline:-10px;border-radius:8px 8px 0 0}
  .survey-save-bar .survey-actions{flex:1 0 100%;justify-content:space-between}
  .survey-save-bar .survey-actions>.button{flex:1}
  .survey-save-bar .survey-status{min-height:16px}
}

.library-page[data-survey-active="true"] #library-count{display:none}
.survey-placement{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:8px;padding:6px 8px;border:1px solid var(--line);border-radius:8px;background:var(--soft);font-size:13px}.survey-placement:not([hidden])+.survey-preview{cursor:crosshair}
.survey-single-stage{position:relative;top:auto;padding:12px}
.survey-stage-controls{display:flex;align-items:end;gap:8px 12px;flex-wrap:wrap;margin-bottom:10px}
.survey-stage-controls>.survey-field{flex:0 1 160px}
.survey-stage-controls>.survey-ceiling-input{flex-basis:178px}
.survey-stage-controls>.survey-thickness{flex-basis:110px}
.survey-stage-controls .survey-stage-label{display:flex;align-items:center;min-height:44px;color:var(--ink);font-size:14px}
.survey-stage-details:not([hidden]){display:grid;gap:8px;margin-top:12px}
.survey-single-stage .survey-preview[data-view="3d"] .survey-3d-stage{height:clamp(300px,55svh,620px)}
.survey-single-stage .survey-preview[data-view="photo"]{padding:8px 12px}
.survey-single-stage .survey-preview[data-view="measure"]{overflow:visible}
.survey-single-stage .survey-preview[data-view="plan"]{min-height:0}
@media(max-width:500px){
  .survey-single-stage{padding:8px}
  .survey-stage-controls{gap:8px}
  .survey-stage-controls>.survey-field{flex:1 1 110px}
  .survey-stage-controls>.survey-thickness{flex-basis:84px}
  .survey-single-stage .survey-preview[data-view="3d"] .survey-3d-stage{height:clamp(280px,45svh,480px)}
}
