.builder-layout{display:grid;grid-template-columns:230px minmax(0,1fr);gap:24px}.template-list{align-self:start}.template-link{display:grid;gap:7px;padding:14px 0;border-top:1px solid var(--border);overflow-wrap:anywhere}.template-link small{color:var(--muted);font-size:12px}.template-link.selected{color:var(--accent)}.builder-field{border:1px solid var(--border);border-radius:6px;padding:20px;display:grid;gap:16px;background:#fafbf8}.field-heading{display:flex;justify-content:space-between;align-items:center;gap:15px}.field-add{display:flex;gap:10px;align-items:flex-end;flex-wrap:wrap}.field-add label{flex:1;min-width:150px}.wide-dialog{max-width:850px}.wide-dialog .dialog-heading{margin-bottom:24px}.report-filters{display:flex;align-items:flex-end;gap:15px;margin-bottom:24px}.report-filters label:first-child{flex:1}.report-link{color:var(--accent);text-decoration:underline}.report-paper{background:var(--paper);border:1px solid var(--border);border-left:3px solid var(--red);padding:35px;box-shadow:3px 3px 0 #dfe4d8;max-width:1000px;margin:auto}.report-metadata{display:grid;grid-template-columns:1fr 1fr;gap:20px;padding-bottom:24px;border-bottom:1px solid var(--rule)}.report-metadata small{display:block;font-size:12px;letter-spacing:1px;color:var(--muted);margin-bottom:8px}.report-metadata strong{font-size:14px;font-weight:500}.report-field{border:1px solid var(--rule);padding:18px;display:grid;gap:15px;min-width:0}.report-field legend{font-size:14px;padding:0 5px}.report-field-label{font-size:16px}.report-field-label input,.report-field-label textarea{background:transparent}.report-paper :disabled{opacity:1;color:var(--ink);-webkit-text-fill-color:var(--ink)}.report-check span{display:grid;gap:7px}.report-field input[type=radio],#preview-fields input[type=checkbox],#preview-fields input[type=radio]{width:18px;min-height:18px;flex-shrink:0}.report-section{border-bottom:1px solid var(--rule);padding-top:12px}.report-section h2{margin-bottom:8px}.photo-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:18px}.photo-thumb{border:1px solid var(--border);padding:0;background:transparent;display:block;width:100%;margin-bottom:10px}.photo-thumb img{width:100%;height:160px;object-fit:cover;display:block}.full-photo{display:block;width:100%;max-height:75vh;object-fit:contain}.report-save{border-top:1px solid var(--rule);padding-top:20px}.report-textarea{resize:vertical}#preview-fields>div{padding-bottom:20px;border-bottom:1px solid var(--rule)}@media(max-width:800px){.builder-layout{grid-template-columns:1fr}.template-list{max-height:240px;overflow:auto}.report-paper{padding:22px}.field-heading{flex-wrap:wrap}.report-filters{flex-wrap:wrap}}@media(max-width:500px){.report-metadata{grid-template-columns:1fr}.report-filters label{width:100%}.builder-field{padding:15px}.row-actions{flex-wrap:wrap}.report-paper{padding:16px}}@media print{.report-save,.report-filters,.photo-thumb+label{display:none!important}.report-paper{border:0;box-shadow:none;padding:0;max-width:none}.report-field,.report-field-label,.photo-grid>div{break-inside:avoid}.report-paper input,.report-paper textarea,.report-paper select{border-color:#aaa}.report-paper input[type=file]{display:none}}

.layout-scroll{overflow:auto;max-height:560px;border:1px solid var(--rule);border-radius:6px}
#layout-canvas{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));min-width:520px;background:repeating-linear-gradient(to bottom,transparent 0,transparent 79px,#cad4d0 79px,#cad4d0 80px),repeating-linear-gradient(to right,#f5f7f2 0,#f5f7f2 calc(8.33333% - 1px),#dce4dc calc(8.33333% - 1px),#dce4dc 8.33333%)}
.layout-tile{margin:5px;padding:8px;background:var(--paper);border:1px solid var(--accent);border-radius:5px;overflow:hidden;display:grid;align-content:center;gap:5px;min-width:0}
.layout-tile small{font-size:11px;color:var(--muted)}
.drag-handle{background:transparent;border:0;text-align:left;cursor:grab;touch-action:none;font:inherit;padding:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ink)}
.dragging{z-index:2;box-shadow:0 4px 12px #0003}.dragging.invalid{border:2px solid #b42318;background:#ffe8e5}
.position-controls{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.report-layout{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:24px 18px;grid-auto-rows:minmax(12px,auto);align-items:start}
.report-cell{min-width:0;overflow-wrap:anywhere}.report-cell>label{display:grid;gap:10px}.report-cell>label.checkbox{display:flex}
.report-cell input:not([type=checkbox]):not([type=radio]),.report-cell select,.report-cell textarea{width:100%;min-width:0;box-sizing:border-box}
.print-report-title,.print-value{display:none}
@media screen and (max-width:600px){.report-layout{display:flex;flex-direction:column}.report-cell{width:100%}.position-controls{gap:6px}}
@media print{
 .print-report-title,.print-value{display:block}.print-value{white-space:pre-wrap;font-weight:400;line-height:1.5;margin:8px 0;color:#000}
 .report-layout input:not([type=checkbox]):not([type=radio]),.report-layout textarea,.report-layout select{display:none!important}
 .report-field>label:has(input[type=file]){display:none!important}
 .report-layout{gap:16px 12px}.report-cell{break-inside:avoid}.report-paper{color:#000}
 .photo-grid{grid-template-columns:repeat(auto-fit,minmax(100px,1fr))}.photo-thumb img{height:auto;max-height:240px;object-fit:contain}
 .report-check input,.report-field input[type=radio]{appearance:auto!important;accent-color:#000}
}

/* Canvas designer: the paper and inspector scroll independently of the toolbar. */
.designer-heading{margin-bottom:16px!important}.designer-heading h1{font-size:28px}
.template-picker{position:relative}.template-picker summary{cursor:pointer;padding:10px 16px;border:1px solid var(--border);border-radius:6px}
.template-picker .template-list{position:absolute;right:0;top:100%;width:260px;max-height:340px;overflow:auto;z-index:10;background:var(--paper)}
.designer{display:flex;flex-direction:column;height:calc(100dvh - 215px);min-height:470px;border:1px solid var(--border);border-radius:8px;background:var(--paper);overflow:hidden}
.designer.expanded{position:fixed;inset:12px;z-index:90;height:auto;min-height:0;box-shadow:0 0 0 30px #18291acc}
.designer-header,.designer-toolbar{display:flex;align-items:center;gap:10px;padding:12px 16px;border-bottom:1px solid var(--border);flex-shrink:0;flex-wrap:wrap;background:var(--paper)}
.designer-header>label:first-child{flex:1;min-width:160px;display:flex;align-items:center;gap:10px}.designer-header input[name=title]{min-width:120px}
.designer-header .checkbox{white-space:nowrap}.designer-header .button,.designer-toolbar .button{padding:9px 12px;font-size:13px}
.designer-toolbar{background:#f2f5ef;padding:8px 16px}.designer-toolbar label{display:flex;align-items:center;gap:6px;font-size:12px}
.designer-toolbar select{padding:8px;min-height:36px;max-width:170px}.designer-toolbar .field-jump{margin-left:auto}
.designer-body{display:grid;grid-template-columns:minmax(0,1fr) 280px;flex:1;min-height:0}
.canvas-workspace{display:flex;flex-direction:column;min-width:0;min-height:0;background:#e7ece5;padding:14px}
.canvas-hint{font-size:12px;color:#536055;margin-bottom:10px;flex-shrink:0}
.designer .layout-scroll{flex:1;min-height:0;max-height:none;overflow:auto;border:1px solid #c0cdbd;border-radius:2px;background:#fff;overscroll-behavior:contain}
.designer #layout-canvas{min-width:600px;min-height:100%;background:repeating-linear-gradient(to bottom,transparent 0,transparent 79px,#dce5e0 79px,#dce5e0 80px),repeating-linear-gradient(to right,#fff 0,#fff calc(8.33333% - 1px),#edf1ed calc(8.33333% - 1px),#edf1ed 8.33333%)}
.designer .layout-tile{position:relative;margin:6px 4px;background:#fafbf8;border:1px solid #bfccbf;border-radius:4px;padding:9px 22px 9px 12px;gap:6px;overflow:visible}
.designer .layout-tile.selected{border:2px solid var(--accent);padding:8px 21px 8px 11px;background:#f1f7eb}
.designer .layout-tile.invalid{border-color:#b42318;background:#ffe8e5}
.designer .drag-handle{display:block;width:100%;min-height:24px;font-size:14px}
.designer .layout-tile small{pointer-events:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.resize-handle{position:absolute;right:-4px;top:0;bottom:0;width:17px;cursor:ew-resize;touch-action:none;border:0;background:transparent;color:var(--accent);padding:0;font-size:14px}
.layout-tile.selected .resize-handle{background:#dceacb88}.resize-handle:focus-visible,.drag-handle:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.designer-inspector{overflow:auto;overscroll-behavior:contain;padding:16px;border-left:1px solid var(--border);min-height:0}
.designer-inspector h2{font-size:17px;margin:0 0 14px}.designer .builder-field{background:transparent;border:0;padding:0;gap:14px}
.designer .builder-field label{font-size:12px}.designer .builder-field input,.designer .builder-field select,.designer .builder-field textarea{padding:9px;min-width:0}
.designer .position-controls{grid-template-columns:1fr 1fr;gap:10px}.designer .position-controls label:last-child{grid-column:1 / -1}
.form-instructions{margin-top:20px;border-top:1px solid var(--border);padding-top:15px;font-size:13px}.form-instructions summary{cursor:pointer;margin-bottom:12px}
.designer #layout-status{flex-shrink:0;margin:0;padding:9px 16px;background:#f2f5ef;border-top:1px solid var(--border);font-size:12px;min-height:34px;box-sizing:border-box}
.designer-menu{position:fixed;z-index:120;min-width:205px;max-height:calc(100dvh - 16px);overflow:auto;padding:8px;background:#fff;color:#18251c;border:1px solid #c2ccc2;border-radius:8px;box-shadow:0 8px 28px #0003}
.designer-menu[hidden]{display:none}.designer-menu strong{display:block;padding:6px 10px;font-size:12px;color:#536055}
.designer-menu .button{display:block;text-align:left;width:100%;background:transparent;border:0;padding:7px 10px;font-size:13px;border-radius:3px}
.designer-menu .button:hover,.designer-menu .button:focus{background:#e9f1e2}
@media(max-width:1000px){.designer-body{grid-template-columns:minmax(0,1fr) 235px}.designer-toolbar .field-jump{margin-left:0}.designer-toolbar{gap:6px}}
@media(max-width:650px){.designer{height:calc(100dvh - 165px);min-height:540px}.designer-body{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(150px,1fr) 210px}.designer-inspector{border-left:0;border-top:1px solid var(--border)}.designer .builder-field{grid-template-columns:1fr 1fr}.designer .builder-field .row-actions,.designer .builder-field .position-controls{grid-column:1 / -1}.designer-header,.designer-toolbar{padding:8px}.canvas-workspace{padding:8px}.designer.expanded{inset:0;border-radius:0}.designer-header>label:first-child{width:100%;flex:auto}}

.designer #layout-canvas{grid-auto-rows:80px}


/* Print real outlines and marks, even when background graphics are disabled. */
.print-choice{display:none}
@media print{
 .report-paper .print-value{border:1pt solid #000;border-radius:0;min-height:24pt;padding:7pt 8pt;box-sizing:border-box;box-decoration-break:clone;-webkit-box-decoration-break:clone}
 .report-paper .report-field{border:1pt solid #000}
 .report-paper .report-check{border:1pt solid #000;padding:8pt;box-sizing:border-box}
 .report-paper .report-section,.report-paper .report-metadata{border-bottom:1pt solid #000}
 .report-paper .photo-thumb{border:1pt solid #000}
 .report-layout input[type=checkbox][name^="answer["],.report-layout input[type=radio][name^="answer["]{display:none!important}
 .report-paper .print-choice{display:inline-block!important;position:relative;box-sizing:border-box;border:1pt solid #000;width:12pt;height:12pt;min-width:12pt;flex:0 0 12pt;vertical-align:middle;margin:0;gap:0}
 .report-paper .print-choice.checkbox.checked::after{content:"";position:absolute;left:3pt;top:0pt;width:4pt;height:7pt;border:solid #000;border-width:0 1.5pt 1.5pt 0;transform:rotate(45deg)}
 .report-paper .print-choice.radio{border-radius:50%}
 .report-paper .print-choice.radio.checked::after{content:"";position:absolute;inset:2pt;border:3pt solid #000;border-radius:50%}
}

.photo-download{display:inline-block;margin:0 0 10px;color:var(--accent);text-decoration:underline;font-size:13px}
@media print{.photo-download,.photo-grid label:has(input[name="remove_photos[]"]){display:none!important}}
.report-audio-section{margin-top:1.5rem}.report-audio-item{display:grid;gap:.7rem;padding:1rem 0;border-top:1px solid var(--rule,#c3d8de)}.report-audio-item audio{width:min(100%,540px)}.report-transcript{white-space:normal;overflow-wrap:anywhere}
@media print{.report-audio-item audio,.report-audio-item .button,.report-audio-item form button{display:none}.report-audio-section textarea{border:0;resize:none}}
