:root{font-family:Inter,system-ui,-apple-system,sans-serif;color:#1c2637;background:#f1f4fb;font-size:14px;--brand:#255ca8;--line:#d1dbea}*{box-sizing:border-box}body{margin:0}header{background:#fcfcff;border-bottom:1px solid var(--line);min-height:76px;padding:14px 24px;display:flex;align-items:center;justify-content:space-between;gap:16px}.brand{font-weight:800;color:var(--brand);font-size:21px;text-decoration:none}.brand span{font-weight:400;font-size:14px;margin-left:12px;color:#566276}.actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}button,select,input,textarea{font:inherit}button{min-height:48px;background:#fcfcff;border:1px solid var(--line);border-radius:10px;padding:8px 14px;cursor:pointer;color:inherit}button:hover{border-color:var(--brand);background:#dce9ff}button:disabled{opacity:.5;cursor:wait}.primary,button.active{background:var(--brand);color:white;border-color:var(--brand)}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #accbff;outline-offset:2px}main{display:grid;grid-template-columns:270px minmax(580px,1fr) 260px;align-items:start}aside{background:#fcfcff;padding:20px;min-height:calc(100vh - 100px)}.left{border-right:1px solid var(--line)}.right{border-left:1px solid var(--line)}h1{font-size:24px;line-height:1.2;margin:0 0 12px}h2{font-size:15px;margin:0 0 12px}.muted{color:#566276;line-height:1.6}label{display:block;margin:12px 0;line-height:1.5}label>span{display:block;font-weight:600;font-size:12px;margin-bottom:5px}input:not([type=checkbox]),select,textarea{width:100%;min-height:48px;padding:10px;border:1px solid var(--line);border-radius:8px;background:#fff;color:#1c2637}input[type=color]{padding:5px}.check{display:flex;gap:10px;align-items:center;min-height:48px}.check span{margin:0}input[type=checkbox]{width:20px;height:20px}hr{border:0;border-top:1px solid var(--line);margin:24px 0}.palette{display:grid;grid-template-columns:1fr 1fr;gap:8px}.palette button:last-child{grid-column:span 2}.workspace{padding:20px}.tabs{display:flex;gap:8px;flex-wrap:wrap}.tools{display:flex;gap:8px;margin-top:16px;flex-wrap:wrap}.grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.grid label{margin:5px 0}#status{min-height:30px;line-height:1.6;padding:6px 24px;background:#dce9ff}#status.error{background:#fdebe9;color:#8a241b}#canvasWrap{padding:20px 0;overflow:auto}#canvas{position:relative;width:523px;height:680px;background:white;box-shadow:0 8px 30px #1c263718;outline-offset:4px;margin:auto;background-image:linear-gradient(#255ca806 1px,transparent 1px),linear-gradient(90deg,#255ca806 1px,transparent 1px);background-size:10px 10px}.element{position:absolute;overflow:hidden;cursor:move;touch-action:none;outline:1px dashed transparent;user-select:none;white-space:pre-wrap;line-height:1.4;display:flex;align-items:center}.element.selected{outline:2px solid #255ca8;z-index:2}.element:focus{outline:2px solid #255ca8}.element img{width:100%;height:100%;object-fit:contain;pointer-events:none}.element .text{width:100%;pointer-events:none;overflow-wrap:anywhere}.handle{position:absolute;right:0;bottom:0;width:20px;height:20px;background:#255ca8;cursor:nwse-resize;display:none}.selected .handle{display:block}.flow-row{background:white;display:flex;align-items:center;gap:12px;min-height:64px;padding:12px;border:1px solid var(--line);border-radius:10px;margin:10px 0}.flow-row span{flex:1}.flow-row button{min-width:48px}#issueEditor{max-width:600px;margin:24px auto;padding:24px;border:1px solid var(--line);border-radius:16px;background:#fcfcff}#preview{margin:24px auto;width:595px;max-width:100%}.preview-page{position:relative;background:white;padding:36px;margin-bottom:24px;box-shadow:0 8px 30px #1c263718;overflow:hidden}.preview-zone{position:relative;width:523px;margin:0 auto}.preview-record{padding:20px 0;border-top:1px solid var(--line);overflow-wrap:anywhere}.preview-photos{display:grid;gap:12px;margin-top:12px}.preview-photo{height:160px;background:#dce9ff;display:grid;place-items:center;color:#255ca8;border:1px solid var(--line)}.preview-note{background:#dce9ff;padding:16px;line-height:1.6}dialog{width:min(440px,95vw);border:1px solid var(--line);border-radius:16px;padding:24px}dialog::backdrop{background:#1c263788}#loginError{color:#8a241b}[hidden]{display:none!important}@media(max-width:1150px){main{grid-template-columns:240px minmax(550px,1fr)}.right{grid-column:1/-1;display:block;min-height:0}.right label{max-width:400px}}@media(max-width:820px){header{padding:12px;align-items:flex-start;flex-direction:column}main{display:flex;flex-direction:column}aside,.workspace{width:100%;min-height:0}.left{border:0}.workspace{padding:12px}.tabs{position:sticky;top:0;background:#f1f4fb;padding:8px 0;z-index:3}#canvasWrap{max-width:100%;padding:20px 4px}#canvas{margin:0}#preview{overflow:auto}.right{border:0}#status{padding:8px 12px}}

.element table{border-collapse:collapse;width:100%;table-layout:fixed}.element td{border:1px solid #d1dbea;padding:4px;overflow-wrap:anywhere}.signature-slot{width:100%;height:100%;display:grid;place-items:center;background:#dce9ff;border:1px dashed #255ca8;color:#255ca8;text-align:center;padding:8px}
.starter-section{padding:24px;border-bottom:1px solid var(--line);background:#fcfcff}.starter-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}.starter-card{padding:16px;border:1px solid var(--line);border-radius:12px;display:grid;gap:10px}.starter-card img{width:100%;height:180px;object-fit:contain;background:#f1f4fb}.starter-card h3,.starter-card p{margin:0}.starter-card p{line-height:1.5;color:#566276}.starter-card a{min-height:48px;display:flex;align-items:center;color:var(--brand)}.preview-toolbar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:16px 0}.preview-toolbar select{width:110px}.full-report-page{position:relative;width:595px;padding:36px;background:white;margin-bottom:32px;box-shadow:0 8px 30px #1c263718;break-after:page;color:#1c2637}.report-body{overflow:hidden;width:523px}.report-page-label{position:absolute;bottom:8px;right:20px;font-size:10px;color:#566276}.report-issue-title{font-size:15px;padding:10px;border-left:4px solid #255ca8;background:#f1f4fb;margin:8px 0 12px}.report-block h3{font-size:9px;color:#566276;margin:4px 0}.report-block p{line-height:1.6;margin:4px 0}.report-overview{padding:12px;background:#dce9ff;margin-bottom:16px}.preview-photos figure{margin:0}.preview-photos img{width:100%;object-fit:contain;background:#f1f4fb}.preview-photos figcaption{font-size:8px;color:#566276}.repair-comparison{display:grid;grid-template-columns:1fr 1fr;gap:12px}.repair-comparison img{width:100%;height:145px;object-fit:contain}.repair-comparison h4{margin:6px 0;font-size:9px}.report-disclaimer{font-size:9px;background:#f1f4fb;padding:12px}.report-stack{transform-origin:top left}@media(max-width:820px){.starter-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.starter-section{padding:16px}.starter-card{padding:12px}.starter-card img{height:140px}}@media(max-width:420px){.starter-grid{grid-template-columns:1fr}.starter-card img{height:180px}}@media print{body>*{display:none!important}main{display:block!important}main>*{display:none!important}main>.workspace{display:block!important;padding:0}.workspace>*{display:none!important}.workspace>#preview{display:block!important;margin:0;width:auto;overflow:visible}#preview>*{display:none!important}#preview>.report-stack{display:block!important;zoom:1!important}.full-report-page{box-shadow:none;margin:0;break-after:page}html,body{background:white}@page{size:auto;margin:0}}
@media(prefers-color-scheme:dark){:root{color:#fcfcff;background:#131b29;--brand:#accbff;--line:#353a3f}header,aside,.starter-section,.starter-card,button,dialog,#issueEditor{background:#202b3d;color:#fcfcff}input:not([type=checkbox]),select,textarea{background:#2a384e;color:#fcfcff}.muted,.starter-card p,.brand span{color:#a1a1a8}.tabs{background:#131b29}.preview-note,#status{background:#2f486c;color:#fcfcff}.primary,button.active{background:#255ca8;color:#fff}button:hover{background:#2f486c}.flow-row{background:#2a384e}.full-report-page{background:#fff;color:#1c2637}.starter-card img{background:#2a384e}}@media print{.full-report-page{print-color-adjust:exact;-webkit-print-color-adjust:exact}}
#previewQrCanvas{display:block;width:min(336px,100%);height:auto;margin:16px auto;image-rendering:pixelated;background:white}#previewQrDialog p{line-height:1.6}

.starter-mobile{display:none}
@media(max-width:820px){
 .starter-grid{display:none}
 .starter-section{padding:12px 16px}
 .starter-section>h2,.starter-section>p{display:none}
 .starter-mobile{display:grid;gap:8px}
 .starter-mobile label,.starter-mobile p{margin:0}
 .starter-mobile-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
 .starter-mobile-actions a{min-height:48px;padding:8px 12px;display:flex;align-items:center;justify-content:center;text-align:center;color:var(--brand);border:1px solid var(--line);border-radius:10px;line-height:1.5}
}

details[data-responsive]>summary{font-weight:600;font-size:15px;min-height:48px;display:flex;align-items:center;cursor:pointer;gap:8px}
details[data-responsive]>summary::before{content:'▸'}
details[data-responsive][open]>summary::before{content:'▾'}
.mobile-canvas-tools{display:none}
@media(min-width:821px){#editorTools>summary{display:none}}
@media(max-width:820px){
 header{display:grid;grid-template-columns:1fr 110px;align-items:center;gap:8px}
 .brand{font-size:18px}.brand span{display:none}
 header .actions{display:contents}
 #language{grid-column:2;grid-row:1;width:100%}
 #shortcutsHelp{display:none}
 #loginOpen,#signout{grid-column:1;grid-row:2}
 #save{grid-column:2;grid-row:2}
 #appPreview{grid-column:1/-1;grid-row:3}
 .left{padding:0 16px;border-bottom:1px solid var(--line)}
 .editor-tools-body{padding-bottom:16px}
 .editor-tools-body>h1,.editor-tools-body>p{display:none}
 .tabs{flex-wrap:nowrap;overflow-x:auto;position:static;padding:0 0 8px}
 .tabs button{flex:0 0 auto}
 .tools{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:8px}
 .mobile-canvas-tools{display:grid;gap:8px;margin-top:12px;grid-template-columns:minmax(0,1fr) 110px;align-items:end}
 .mobile-canvas-tools label{margin:0}
 #mobileEditElement{min-height:48px}
 #canvasHint{font-size:12px;line-height:1.5;margin:8px 0}
 #canvasWrap{padding:8px 4px}
 #canvas{margin:0}
 .right{padding:0 16px 24px}
 #elementPanel,#samplePanel{border-top:1px solid var(--line);scroll-margin-top:12px}
 dialog{max-height:calc(100dvh - 24px);overflow-y:auto}
 input,select,textarea{font-size:16px}
}

@media(max-width:820px){
 #mobileDragToggle{grid-column:1/-1}
 #mobileDragToggle[aria-pressed=true]{border-color:var(--brand);background:#dce9ff;color:#255ca8}
 #canvas .element{touch-action:pan-y}
 #canvas.touch-drag-enabled .element{touch-action:none}
}

/* The App supplies the title and SafeArea; keep actions within thumb reach. */
@media(max-width:820px){
 body.embedded-app{padding-bottom:80px}
 .embedded-app header{position:fixed;inset:auto 0 0;z-index:30;min-height:64px;padding:8px 12px;border-top:1px solid var(--line);border-bottom:0;display:block}
 .embedded-app header .brand{display:none}
 .embedded-app header .actions{display:grid;grid-template-columns:1fr 1fr;width:100%;gap:8px;align-items:stretch}
 .embedded-app header .actions>:not(#appPreview):not(#save){display:none!important}
 .embedded-app header .actions [hidden]{display:none}
 .embedded-app #appPreview{grid-column:auto;grid-row:auto;order:0}
 .embedded-app #save{grid-column:auto;grid-row:auto;order:1}
 .embedded-app header .actions>button{width:100%;height:100%;min-width:0;min-height:52px;margin:0;display:flex;align-items:center;justify-content:center;text-align:center;line-height:1.25}
 .embedded-app .starter-mobile-actions>*{width:100%;min-width:0;min-height:52px;margin:0;display:flex;align-items:center;justify-content:center;text-align:center}
 .embedded-app .editor-tools-body>.actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;align-items:stretch}
 .embedded-app .editor-tools-body>.actions>button{width:100%;min-width:0;margin:0}
 .embedded-app .editor-tools-body>.actions>button:last-child:nth-child(odd){grid-column:1/-1}
 .embedded-app .palette>button,.embedded-app .tools>button,.embedded-app .mobile-canvas-tools>button{width:100%;min-width:0;margin:0}
 .embedded-app #properties>button{width:100%;margin:8px 0 0}
}

:root[data-app-theme=dark]{color:#fcfcff;background:#131b29;--brand:#accbff;--line:#353a3f}
[data-app-theme=dark] header,[data-app-theme=dark] aside,[data-app-theme=dark] .starter-section,[data-app-theme=dark] .starter-card,[data-app-theme=dark] button,[data-app-theme=dark] dialog,[data-app-theme=dark] #issueEditor{background:#202b3d;color:#fcfcff}
[data-app-theme=dark] input:not([type=checkbox]),[data-app-theme=dark] select,[data-app-theme=dark] textarea,[data-app-theme=dark] .flow-row{background:#2a384e;color:#fcfcff}
[data-app-theme=dark] .muted,[data-app-theme=dark] .starter-card p,[data-app-theme=dark] .brand span{color:#a1a1a8}
[data-app-theme=dark] .tabs{background:#131b29}
[data-app-theme=dark] .preview-note,[data-app-theme=dark] #status,[data-app-theme=dark] button:hover{background:#2f486c;color:#fcfcff}
[data-app-theme=dark] .primary,[data-app-theme=dark] button.active{background:#255ca8;color:#fff}
[data-app-theme=dark] .full-report-page{background:#fff;color:#1c2637}

.embedded-app input:not([type=checkbox]),.embedded-app select,.embedded-app textarea{font-size:max(16px,1em)}
