:root{--ink:#203d39;--muted:#7c8986;--emerald:#147366;--edge:#e2e8e4;--paper:#fff;--surface:#f8faf8;--accent:#eef6f1;font-family:Inter,"Segoe UI",Arial,sans-serif;font-size:13px;color:var(--ink)}
*{box-sizing:border-box}body{margin:0;background:var(--surface)}button,input,select{font:inherit}button,select{border:1px solid var(--edge);background:white;color:var(--ink);border-radius:6px;padding:8px 11px}button{cursor:pointer;white-space:nowrap;transition:background .15s}button:hover{background:#edf5f0;border-color:#b5cfc3}button:disabled{opacity:.38;cursor:default}button.primary{background:var(--emerald);color:white;border-color:var(--emerald)}button.primary:hover{background:#0b5d55}button.active{background:var(--accent);color:var(--emerald);border-color:#9dc5b5}input:focus,button:focus-visible,select:focus{outline:2px solid #64ae95;outline-offset:2px}input[type=checkbox]{accent-color:var(--emerald)}kbd{font:10px "Segoe UI",sans-serif;opacity:.7;margin-left:10px}header{height:84px;display:flex;align-items:center;gap:12px;padding:0 22px;border-bottom:1px solid var(--edge);background:white}.brand{display:flex;align-items:center;gap:10px;color:var(--ink);text-decoration:none;font-weight:700;font-size:17px;min-width:218px}.brand small{display:block;font-size:8px;letter-spacing:1.7px;font-weight:600;margin-top:5px;color:var(--muted)}.brand-icon{display:grid;place-content:center;width:34px;height:38px;border-radius:10px;background:var(--emerald);color:white;font-size:34px;font-weight:400}.document-heading{flex:1;display:flex;gap:6px;align-items:flex-start;flex-direction:column;min-width:150px}.local-badge{font-size:8px;font-weight:700;letter-spacing:1.3px;color:var(--emerald)}.document-heading strong{font-size:14px}.document-heading #save-state{font-size:10px;color:var(--muted)}.export-group{display:flex;gap:5px}.export-group select{max-width:126px}main{height:calc(100vh - 84px);display:grid;grid-template-columns:226px minmax(300px,1fr) 260px}aside{background:white}.library{border-right:1px solid var(--edge);display:flex;flex-direction:column;padding:24px 12px 12px;min-height:0}.section-heading{font-size:10px;letter-spacing:1.5px;font-weight:700;display:flex;align-items:center;justify-content:space-between;gap:6px}.section-heading span{font-size:9px;color:var(--muted);letter-spacing:.3px;font-weight:500}.library .section-heading{padding:0 8px 17px}.search{border:1px solid var(--edge);border-radius:6px;background:var(--surface);padding:10px;width:100%;font-size:12px;margin-bottom:16px}.catalog{overflow-y:auto;flex:1}.drawing-card{display:block;text-align:left;width:100%;padding:11px 12px;border:1px solid transparent;margin:3px 0;border-radius:6px;background:transparent;white-space:normal}.drawing-card .card-title{display:block;font-weight:600;font-size:12px;line-height:1.5}.drawing-card small{display:block;color:var(--muted);font-size:10px;margin-top:3px}.drawing-card.active{border-color:#cae2d6;background:#f0f7f2;box-shadow:inset 3px 0 var(--emerald)}.saved-dot{float:right;width:6px;height:6px;border-radius:50%;background:var(--emerald);margin:6px 0}.library-footer{font-size:10px;line-height:1.9;padding:14px 8px 2px;border-top:1px solid var(--edge);margin-top:12px}.muted{color:var(--muted)}.dot{display:inline-block;height:5px;width:5px;border-radius:50%;background:var(--emerald);margin-right:5px}.workspace{min-width:0;display:flex;flex-direction:column;min-height:0}.toolbar{height:55px;display:flex;align-items:center;gap:10px;padding:0 14px;border-bottom:1px solid var(--edge);background:#fcfdfc}.tool-group{display:flex;gap:3px;border-right:1px solid var(--edge);padding-right:10px}.wire-colors{display:flex;align-items:center;gap:8px;margin-left:2px}.wire-colors[hidden]{display:none}.toolbar .wire-swatch{display:block;width:22px;height:22px;min-width:22px;padding:0;border:2px solid #fff;border-radius:50%;box-shadow:0 0 0 1px var(--edge);transition:transform .12s,box-shadow .12s,border-color .12s}.toolbar .wire-swatch:hover{transform:scale(1.08);border-color:#fff;box-shadow:0 0 0 2px var(--emerald)}.toolbar .wire-swatch.active{box-shadow:0 0 0 2px var(--paper),0 0 0 4px var(--emerald)}.toolbar button{padding:6px 8px;font-size:11px}.toolbar-right{margin-left:auto;display:flex;align-items:center;gap:5px}.toolbar-right span{font-size:10px;min-width:34px;text-align:center}.check{font-size:10px;display:flex;align-items:center;gap:3px;white-space:nowrap}.grid-step{font-size:10px;padding:4px 5px;border-radius:5px;width:auto;background:white}.viewport{flex:1;position:relative;overflow:hidden;background-color:#eef1ee;background-image:radial-gradient(#cdd7d0 .7px,transparent .7px);background-size:16px 16px;touch-action:none}.viewport svg{position:absolute;inset:0;width:100%;height:100%;touch-action:none;user-select:none}.viewport.pan{cursor:grab}.viewport.panning{cursor:grabbing}.viewport.add{cursor:crosshair}.viewport.pin-hover:not(.text):not(.pan):not(.panning),.viewport.pin-hover:not(.text):not(.pan):not(.panning) *{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M2.5 21.5l3.8-.8L20.6 6.4a2.2 2.2 0 0 0-3.1-3.1L3.2 17.6l-.7 3.9Z' fill='%23fff' stroke='%23147366' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M15.9 4.9l3.2 3.2' stroke='%23147366' stroke-width='1.5'/%3E%3Cpath d='M2.5 21.5l.8-3.8 3 3-3.8.8Z' fill='%23147366'/%3E%3C/svg%3E") 3 21,crosshair!important}.canvas-badge{position:absolute;bottom:18px;left:18px;font-size:8px;letter-spacing:1.4px;color:#7c8c83;background:#f9fcf9df;border:1px solid #e0e8df;border-radius:4px;padding:7px 9px;pointer-events:none}.statusbar{display:flex;gap:15px;align-items:center;height:29px;padding:0 14px;font-size:10px;color:#75837a;border-top:1px solid var(--edge);background:#fcfdfb}.statusbar #status{flex:1}.statusbar #coordinates{min-width:70px}.empty{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center}.empty-symbol{font-size:64px;color:#6d9987;font-weight:200}.empty h1{font-size:24px;font-weight:500;letter-spacing:-.7px;margin:15px 0 5px}.empty p{line-height:1.9;color:var(--muted);font-size:13px}.inspector{border-left:1px solid var(--edge);padding:25px 19px 18px;overflow-y:auto}.no-selection{text-align:center;padding:30px 0 8px}.no-selection>span{font-size:35px;color:#a2b9ad}.no-selection h3{font-size:13px;font-weight:600}.no-selection p,.help{font-size:11px;color:var(--muted);line-height:1.7}.net-card{margin:22px 0;display:flex;align-items:center;gap:10px}.net-card>span:first-child{width:6px;height:36px;border-radius:4px}.net-card small{font-size:8px;letter-spacing:1px;color:var(--muted)}.net-card strong{display:block;margin-top:3px;font-size:18px}.net-card #mode-badge{margin-left:auto;font-size:9px;color:var(--muted);padding:4px 6px;background:var(--surface);border-radius:4px}.field{display:flex;align-items:center;justify-content:space-between;font-size:11px;margin:15px 0}.field:has(input[type=range]){display:block}.field label{display:block;margin-bottom:7px}.field label span{float:right;color:var(--muted)}input[type=color]{width:31px;height:26px;padding:2px;border:1px solid var(--edge);background:white;border-radius:5px}input[type=range]{width:100%;accent-color:var(--emerald);height:4px}.subsection{border-top:1px solid var(--edge);padding-top:20px;margin-top:22px;margin-bottom:12px}.field-label{font-size:10px;color:var(--muted);display:block;margin-bottom:7px}.inspector select{width:100%;font-size:11px}.segmented{display:flex;margin:8px 0}.segmented button{flex:1;font-size:10px;border-radius:0;padding:8px 5px}.segmented button:first-child{border-radius:5px 0 0 5px}.segmented button:last-child{border-radius:0 5px 5px 0}.wide{width:100%;font-size:11px;margin-top:7px;text-align:left;padding:9px}.route-buttons{display:flex;gap:5px}.route-buttons button{flex:1;font-size:10px;padding:8px 3px}.text-button{border:none;background:transparent;color:var(--emerald);font-size:10px;padding:10px 0;white-space:normal;text-align:left}.connection{display:flex;gap:10px;align-items:center;margin:12px 0}.endpoint{border:1px solid var(--edge);border-radius:50%;font-size:9px;width:21px;height:21px;display:grid;place-content:center;color:var(--muted)}.connection code{font-size:10px;overflow-wrap:anywhere}.check-results{font-size:10px;color:var(--muted);line-height:1.7;max-height:180px;overflow:auto}.check-results button{display:block;border:none;border-left:2px solid #d7a247;border-radius:0;text-align:left;font-size:10px;padding:6px;margin:5px 0;white-space:normal;background:#fffbf3;width:100%}.check-results .ok{color:var(--emerald)}.small-button{font-size:9px;letter-spacing:0;padding:4px 7px}.inspector-bottom{border-top:1px solid var(--edge);margin-top:25px;padding-top:18px}.inspector-bottom strong{font-size:11px}.inspector-bottom p{font-size:10px;color:var(--muted);line-height:1.7}.loading{position:absolute;inset:0;background:#f6f8f5d9;display:flex;justify-content:center;align-items:center;gap:12px;font-size:12px;z-index:10}.spinner{width:17px;height:17px;border:2px solid #d0e1d5;border-top-color:var(--emerald);border-radius:50%;animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}[hidden]{display:none!important}#toast{position:fixed;bottom:45px;left:50%;transform:translateX(-50%);background:#203e34;color:white;border-radius:7px;padding:12px 20px;font-size:12px;box-shadow:0 6px 28px #10241c30;z-index:20;max-width:70vw}dialog{border:1px solid var(--edge);border-radius:12px;padding:26px;max-width:390px;box-shadow:0 20px 80px #10241c30}dialog::backdrop{background:#17362b45}dialog h2{font-size:18px}dialog p{color:var(--muted);font-size:12px;line-height:1.8}dialog>div{display:flex;gap:8px;justify-content:flex-end;margin-top:24px}.wire-hit{cursor:pointer;stroke:transparent;fill:none;pointer-events:stroke}.wire-path{fill:none;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}.endpoint-marker{fill:#fff;stroke:#147366;pointer-events:none}.handle{cursor:move}.handle.control{fill:white;stroke:#258773}.handle.knot{fill:#147366;stroke:white}.handle.locked{fill:white;stroke:#147366;cursor:default}.control-line{stroke:#44a48c;stroke-dasharray:1 1;fill:none;pointer-events:none}.warning-marker{fill:#e4a842;stroke:white;stroke-width:.35;pointer-events:none}.wire-halo{fill:none;stroke:#d6eee2;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}@media(max-width:1150px){main{grid-template-columns:190px minmax(280px,1fr) 230px}header{padding:0 15px;gap:8px}.brand{min-width:180px}.toolbar{gap:5px;padding:0 8px}.check .muted{display:none}kbd{display:none}.inspector{padding:22px 14px}}@media(max-width:850px){main{grid-template-columns:160px minmax(260px,1fr)}.inspector{position:absolute;right:12px;top:148px;width:220px;max-height:65vh;box-shadow:0 4px 25px #14291f20;border-radius:8px;z-index:3}.inspector:has(#wire-properties[hidden]){display:none}.document-heading .local-badge{display:none}.brand{min-width:150px;font-size:14px}.brand small{font-size:7px}.document-heading{min-width:0}.document-heading strong{font-size:12px}header{height:76px}main{height:calc(100vh - 76px)}#import{display:none}.toolbar .check{display:none}.tool-group{padding-right:4px}.toolbar button{padding:6px}.statusbar #coordinates{display:none}}

.snap-point{fill:#daf1e5;stroke:#298f73;opacity:.75;pointer-events:none}.snap-ring{fill:#e6a93c35;stroke:#d89119;pointer-events:none}.ic-pin-snap{fill:none;stroke:#22a06b;stroke-width:.18;opacity:.95;pointer-events:none}.ic-pin-snap-dot{fill:#22a06b;pointer-events:none}.handle.endpoint-edit{fill:#147366;stroke:white;cursor:move}.inspector .check{font-size:10px;line-height:1.6;white-space:normal}

.component-art{cursor:move}.component-outline{fill:none;stroke:#147366;pointer-events:none}.rotate-handle{cursor:crosshair}.rotate-handle-bg{fill:white;stroke:#147366}.rotate-handle-icon{fill:#147366;stroke:none}.placement-fields{display:flex;gap:8px;margin:18px 0}.placement-fields label{font-size:10px;color:var(--muted);width:50%}.placement-fields input{width:100%;border:1px solid var(--edge);border-radius:5px;padding:7px;margin-top:7px;color:var(--ink)}#component-name{font-size:13px;overflow-wrap:anywhere}#wire-preview{pointer-events:none}#components text{cursor:move}
.free-text{cursor:move}.text-outline{fill:none;stroke:#147366;stroke-dasharray:4 3;pointer-events:none}.free-text text{pointer-events:none}.viewport.text{cursor:text}#text-value{width:100%;min-height:72px;border:1px solid var(--edge);border-radius:6px;padding:8px;resize:vertical;color:var(--ink);font:inherit}
.new-drawing{width:100%;margin:10px 0 8px;font-size:12px}.component-palette{display:flex;flex-direction:column;gap:4px;overflow-y:auto;max-height:30vh;padding-right:2px;margin-bottom:8px}.palette-item{display:flex;align-items:center;gap:8px;text-align:left;padding:4px 6px;font-size:11px;line-height:1.25;white-space:normal}.palette-item img{width:30px;height:24px;object-fit:contain;flex:none}.palette-item .palette-thumb{width:36px;height:28px;flex:none;background-repeat:no-repeat}.palette-item small{display:block;color:var(--muted);font-size:9px;margin-top:2px}.palette-item:hover{background:#edf5f0}.palette-empty{font-size:10px;color:var(--muted);line-height:1.6;padding:4px 6px}.danger{color:#8c3c35 !important}.danger:hover{background:#fbf0ef !important;border-color:#d8b2ad !important}
.placement-fields{display:grid;grid-template-columns:1fr 1fr 1fr;gap:6px}.placement-fields label{width:auto}
#new-dialog form{display:flex;flex-direction:column;gap:8px}#new-dialog input{width:100%;border:1px solid var(--edge);border-radius:5px;padding:8px;color:var(--ink)}.dialog-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:10px}
#save-as-dialog form,#directory-dialog form,#generic-ic-dialog form{display:flex;flex-direction:column;gap:8px}#save-as-dialog input,#directory-dialog input,#generic-ic-dialog input,#generic-ic-dialog select{width:100%;border:1px solid var(--edge);border-radius:5px;padding:9px;color:var(--ink);font-size:13px}#directory-dialog .help,#generic-ic-dialog .help{margin:0}
#export-dialog form{display:flex;flex-direction:column;gap:12px}#export-dialog fieldset{border:1px solid var(--edge);border-radius:8px;padding:10px;margin:0;display:flex;flex-direction:column;gap:6px}#export-dialog legend{font-size:9px;letter-spacing:1.2px;font-weight:700;color:var(--muted);padding:0 4px}#export-dialog .check{font-size:11px;gap:7px}

/* Readability and an infinite white drawing surface. */
body{font-size:15px}.viewport{background:#fff;background-image:none}
header button{font-size:14px}.brand{font-size:18px}.brand small{font-size:9px}.local-badge{font-size:9px}.document-heading strong{font-size:15px}.document-heading #save-state{font-size:11px}
.toolbar button{font-size:14px;padding:7px 10px}.toolbar-right span{font-size:12px}.tool-group{gap:4px;padding-right:8px}
.check{font-size:12px}.search{font-size:13px;padding:11px 10px}
.section-heading{font-size:12px}.library-footer{font-size:12px}
.drawing-card .card-title{font-size:15px}.drawing-card small{font-size:12px}
.new-drawing{font-size:14px}.component-palette{max-height:32vh}.palette-item{font-size:13px;padding:6px 7px}.palette-item img{width:36px;height:28px}.palette-item small{font-size:11px}.palette-empty{font-size:12px}
.no-selection h3{font-size:17px}.no-selection p,.help{font-size:13px}.net-card small{font-size:10px}.net-card strong{font-size:20px}#component-name{font-size:16px}.net-card #mode-badge{font-size:10px}
.field{font-size:13px}.field-label{font-size:12px}.inspector select{font-size:13px}.segmented button{font-size:12px;padding:9px 6px}.text-button{font-size:13px}.small-button{font-size:11px}
.check-results{font-size:12px}.check-results button{font-size:12px}.inspector-bottom strong{font-size:13px}.inspector-bottom p{font-size:12px}
.placement-fields label{font-size:12px}.placement-fields input{font-size:14px;padding:8px}.inspector .check{font-size:12px}
.statusbar{height:32px;font-size:12px}.canvas-badge{font-size:8px}#toast{font-size:14px}
dialog h2{font-size:20px}dialog p{font-size:13px}#export-dialog legend{font-size:10px}#export-dialog .check{font-size:13px}
@media(min-width:1151px){main{grid-template-columns:260px minmax(320px,1fr) 310px}}
.file-menu{position:relative}#file-menu-button{font-size:14px;padding:9px 13px}.menu-popup{position:absolute;right:0;top:calc(100% + 6px);z-index:40;min-width:235px;padding:6px;background:white;border:1px solid var(--edge);border-radius:8px;box-shadow:0 18px 50px #10241c26;display:flex;flex-direction:column;gap:2px}.menu-popup[hidden]{display:none}.menu-popup button{border:none;background:transparent;text-align:left;padding:9px 10px;border-radius:5px;font-size:13px;display:flex;justify-content:space-between;gap:24px}.menu-popup button:hover{background:#edf5f0}.menu-popup hr{border:none;border-top:1px solid var(--edge);margin:4px 2px}.menu-popup kbd{margin-left:auto}
.canvas-fab{position:absolute;top:14px;left:14px;z-index:8;width:40px;height:40px;min-width:40px;padding:0;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;background:#fff;border:1px solid var(--edge);box-shadow:0 6px 18px #10241c24;color:var(--ink);transition:background .15s,color .15s,border-color .15s,transform .15s}.canvas-fab svg{display:block;position:static;inset:auto;width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}.canvas-fab:hover{background:#edf5f0;border-color:#b5cfc3;transform:translateY(-1px)}.canvas-fab.active{background:var(--accent);color:var(--emerald);border-color:#9dc5b5}
main{--explorer-width:280px;--right-width:330px;position:relative;display:grid;grid-template-columns:0 0 minmax(320px,1fr) 4px var(--right-width)}main.explorer-open{grid-template-columns:var(--explorer-width) 4px minmax(320px,1fr) 4px var(--right-width)}
.workspace{grid-column:3;grid-row:1}
.right-sidebar{display:flex;flex-direction:column;min-height:0;min-width:0;background:#fff;border-left:1px solid #b7c5bd;grid-column:5;grid-row:1}
.right-sidebar .library{border-right:none;padding:18px 12px 10px;flex:1;min-height:120px}
.right-sidebar .inspector{border-left:none;border-top:none;padding:16px 16px 18px;flex:0 0 var(--inspector-height,45%);max-height:none;min-height:160px;overflow-y:auto;position:static;right:auto;top:auto;bottom:auto;left:auto;width:auto;border-radius:0;box-shadow:none;z-index:auto}
.right-sidebar .inspector:has(#wire-properties[hidden]){display:block}
.splitter{background:#c0cec6;position:relative;z-index:4;touch-action:none}.splitter:hover,.splitter.dragging{background:var(--emerald)}.splitter.vertical{width:4px;cursor:col-resize}.splitter.horizontal{height:5px;flex:0 0 5px;cursor:row-resize}main:not(.explorer-open) #explorer-splitter{display:none}
.drawing-explorer{grid-column:1;grid-row:1;display:flex;flex-direction:column;min-width:0;min-height:0;background:#fff;border-right:1px solid #b7c5bd;padding:18px 12px 12px}
.drawing-explorer[hidden]{display:none}.explorer-head{display:flex;align-items:flex-start;justify-content:space-between;gap:8px}.explorer-head .section-heading{padding:0 0 6px 8px}.explorer-folder{font-size:11px;line-height:1.4;color:var(--muted);word-break:break-all;margin:0 8px 14px}.explorer-folder-label{font-size:10px;font-weight:700;letter-spacing:.8px;color:#65756d;margin:12px 8px 4px;text-transform:uppercase}.explorer-list{display:flex;flex-direction:column;gap:3px;overflow-y:auto;flex:1;min-height:0}.explorer-item{border:1px solid transparent;background:transparent;text-align:left;padding:10px;border-radius:6px;white-space:normal}.explorer-item strong{display:block;font-size:13px;font-weight:600}.explorer-item small{display:block;font-size:11px;line-height:1.4;color:var(--muted);margin-top:3px}.explorer-item:hover{background:#edf5f0}.explorer-item.active{border-color:#cae2d6;background:#f0f7f2;box-shadow:inset 3px 0 var(--emerald)}#explorer-search{margin-bottom:10px}#explorer-open-folder{margin-top:10px}#explorer-splitter{grid-column:2;grid-row:1}#right-splitter{grid-column:4;grid-row:1}
@media(max-width:1150px){main{grid-template-columns:0 0 minmax(280px,1fr) 4px var(--right-width)}main.explorer-open{grid-template-columns:var(--explorer-width) 4px minmax(280px,1fr) 4px var(--right-width)}}
@media(max-width:850px){main,main.explorer-open{grid-template-columns:minmax(260px,1fr) 4px var(--right-width)}.workspace{grid-column:1}#right-splitter{grid-column:2}.right-sidebar{grid-column:3}#explorer-splitter{display:none}.drawing-explorer{position:absolute;left:0;top:76px;bottom:0;width:var(--explorer-width);z-index:6;box-shadow:0 10px 40px #10241c33}}
.drawing-switcher{border-bottom:1px solid var(--edge);padding:0 4px 12px;margin-bottom:16px}.drawing-row{display:flex;gap:6px}.drawing-switcher .field-label{margin-bottom:8px}#drawing-select{flex:1;min-width:0;font-size:13px;padding:9px}#new-drawing{width:42px;font-size:18px;padding:5px}.category-select{width:100%;margin-bottom:12px;font-size:12px;padding:8px}.library .search{margin-bottom:8px}.component-palette{flex:1;max-height:none;min-height:120px}

/* Compact header and icon-only toolbar. */
header{height:60px;gap:10px;padding:0 16px}main{height:calc(100vh - 60px)}
.brand{min-width:196px;font-size:16px;gap:8px}.brand-icon{width:28px;height:30px;border-radius:8px;font-size:27px}.brand small{font-size:8px;letter-spacing:1.3px;margin-top:2px}
.document-heading{gap:2px}.document-heading strong{font-size:14px}.document-heading #save-state{font-size:10px}.local-badge{font-size:8px;letter-spacing:1.1px}
#file-menu-button{font-size:13px;padding:7px 10px}
.header-actions{display:flex;align-items:center;gap:5px;margin-left:2px}
.header-actions .icon-button{width:34px;height:34px;padding:0;display:inline-flex;align-items:center;justify-content:center}
.header-actions .icon-button svg{display:block;width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
.toolbar .icon-button{width:32px;height:32px;padding:0;display:inline-flex;align-items:center;justify-content:center}
.toolbar .icon-button svg{display:block;width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
#fullscreen .icon-exit{display:none}#fullscreen[aria-pressed="true"] .icon-enter{display:none}#fullscreen[aria-pressed="true"] .icon-exit{display:block}#endpoint-lock .icon-unlocked{display:none}#endpoint-lock[aria-pressed="true"] .icon-locked{display:none}#endpoint-lock[aria-pressed="true"] .icon-unlocked{display:block}
@media(max-width:850px){header{height:56px}main{height:calc(100vh - 56px)}.brand{min-width:150px;font-size:14px}.header-actions{gap:3px}.header-actions .icon-button{width:30px;height:30px}}
#select-tool svg{fill:currentColor;stroke:none}
.viewport.route:not(.pan):not(.panning),.viewport.route:not(.pan):not(.panning) *{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M2.5 21.5l3.8-.8L20.6 6.4a2.2 2.2 0 0 0-3.1-3.1L3.2 17.6l-.7 3.9Z' fill='%23fff' stroke='%23147366' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M15.9 4.9l3.2 3.2' stroke='%23147366' stroke-width='1.5'/%3E%3Cpath d='M2.5 21.5l.8-3.8 3 3-3.8.8Z' fill='%23147366'/%3E%3C/svg%3E") 3 21,crosshair!important}
@media(max-width:1100px){.toolbar .check span{display:none}.toolbar .check{gap:0}}
@media(max-width:900px){.toolbar #zoom-label{display:none}}
@media(max-width:1000px){.toolbar .icon-button{width:30px;height:30px}.toolbar{gap:4px;padding:0 6px}.wire-colors{gap:6px}.toolbar .wire-swatch{width:18px;height:18px;min-width:18px}}
#theme-toggle .icon-sun{display:none}html[data-theme="dark"] #theme-toggle .icon-sun{display:block}html[data-theme="dark"] #theme-toggle .icon-moon{display:none}
html[data-theme="dark"]{--ink:#e6edf3;--muted:#8b949e;--emerald:#3bb99f;--edge:#30363d;--paper:#fff;--surface:#0d1117;--accent:#1f2937;--panel:#161b22;--raised:#21262d;--field:#0d1117;--hover:#30363d;color-scheme:dark}
html[data-theme="dark"] body{background:var(--surface);color:var(--ink)}
html[data-theme="dark"] header{background:var(--panel);border-color:var(--edge)}
html[data-theme="dark"] aside,html[data-theme="dark"] .right-sidebar,html[data-theme="dark"] .drawing-explorer{background:var(--panel)}
html[data-theme="dark"] .right-sidebar{border-left-color:var(--edge)}html[data-theme="dark"] .drawing-explorer{border-right-color:var(--edge)}
html[data-theme="dark"] .toolbar{background:#10151b;border-color:var(--edge)}
html[data-theme="dark"] .statusbar{background:#10151b;color:var(--muted);border-color:var(--edge)}
html[data-theme="dark"] button,html[data-theme="dark"] select{background:var(--raised);color:var(--ink);border-color:var(--edge)}
html[data-theme="dark"] button:hover{background:var(--hover);border-color:#484f58}
html[data-theme="dark"] button.active{border-color:#3b5a50}
html[data-theme="dark"] button.primary{background:#1b8f79;border-color:#1b8f79;color:#fff}
html[data-theme="dark"] button.primary:hover{background:#21a68c;border-color:#21a68c}
html[data-theme="dark"] .text-button{background:transparent;border-color:transparent;color:var(--emerald)}
html[data-theme="dark"] .text-button:hover{background:transparent;color:#6bdcc2}
html[data-theme="dark"] .menu-popup{background:var(--panel);border-color:var(--edge);box-shadow:0 18px 50px #000a}
html[data-theme="dark"] .menu-popup button{background:transparent;border-color:transparent}
html[data-theme="dark"] .menu-popup button:hover{background:var(--raised)}
html[data-theme="dark"] .explorer-item,html[data-theme="dark"] .drawing-card{background:transparent;border-color:transparent}
html[data-theme="dark"] .explorer-item:hover,html[data-theme="dark"] .palette-item:hover{background:var(--raised)}
html[data-theme="dark"] .explorer-item.active,html[data-theme="dark"] .drawing-card.active{background:var(--accent);border-color:#30404d;box-shadow:inset 3px 0 var(--emerald)}
html[data-theme="dark"] .search,html[data-theme="dark"] input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),html[data-theme="dark"] textarea{background:var(--field);color:var(--ink);border-color:var(--edge)}
html[data-theme="dark"] .search::placeholder,html[data-theme="dark"] input::placeholder{color:#6e7681}
html[data-theme="dark"] input[type=color]{background:var(--raised);border-color:var(--edge)}
html[data-theme="dark"] input[type=range]{accent-color:var(--emerald)}
html[data-theme="dark"] .grid-step{background:var(--raised)}
html[data-theme="dark"] dialog{background:var(--panel);color:var(--ink);border-color:var(--edge);box-shadow:0 20px 80px #000c}
html[data-theme="dark"] dialog::backdrop{background:#000a}
html[data-theme="dark"] dialog input,html[data-theme="dark"] dialog select,html[data-theme="dark"] dialog textarea{background:var(--field);color:var(--ink);border-color:var(--edge)}
html[data-theme="dark"] .splitter{background:var(--hover)}

html[data-theme="dark"] .check-results button{background:#2a2114;border-left-color:#c69238;color:var(--ink)}
html[data-theme="dark"] .danger{color:#e08a7f!important}
html[data-theme="dark"] .danger:hover{background:#3a2522!important;border-color:#6d403a!important}
html[data-theme="dark"] .no-selection>span{color:#6e7681}
html[data-theme="dark"] .explorer-folder-label{color:var(--muted)}
html[data-theme="dark"] #toast{background:#1f2937;color:#eef8f4;box-shadow:0 6px 28px #000a}
html[data-theme="dark"] .viewport{background:#f8fbf9;color:#203d39}
html[data-theme="dark"] .empty h1{color:#203d39}
html[data-theme="dark"] .empty p{color:#6f8179}
html[data-theme="dark"] .empty-symbol{color:#4f8a76}
html[data-theme="dark"] .loading{background:#f8fbf9;color:#203d39}
html[data-theme="dark"] .spinner{border-color:#d6e2da;border-top-color:#147366}
.brand-logo{display:block;width:30px;height:30px;border-radius:7px;flex:none;object-fit:cover}
.loading{background:#f8faf8}
.loading .spinner{width:22px;height:22px;border-width:3px}
.context-menu{position:fixed;z-index:60;min-width:210px;max-width:calc(100vw - 16px);padding:6px;background:white;border:1px solid var(--edge);border-radius:8px;box-shadow:0 18px 50px #10241c26;display:flex;flex-direction:column;gap:2px}
.context-menu[hidden]{display:none}
.context-menu button{border:none;background:transparent;text-align:left;padding:8px 10px;border-radius:5px;font-size:13px;display:flex;align-items:center;gap:8px;white-space:normal}
.context-menu button:hover{background:#edf5f0}
.context-menu .menu-separator{border-top:1px solid var(--edge);margin:4px 2px}
.context-menu .menu-label{font-size:10px;font-weight:700;letter-spacing:1px;color:var(--muted);padding:7px 10px 3px;text-transform:uppercase}
.context-menu .swatch-row{display:flex;gap:8px;padding:3px 10px 7px}
.context-menu .swatch{display:block;width:22px;height:22px;min-width:22px;padding:0;border:2px solid white;border-radius:50%;box-shadow:0 0 0 1px var(--edge)}
.context-menu .swatch:hover{transform:scale(1.08);border-color:white;box-shadow:0 0 0 2px var(--emerald)}
.context-menu .swatch.selected{box-shadow:0 0 0 2px var(--paper),0 0 0 4px var(--emerald)}
.context-menu .menu-check{margin-left:auto;color:var(--emerald);font-weight:700}
.context-menu .danger{color:#8c3c35}
.context-menu .danger:hover{background:#fbf0ef}
html[data-theme="dark"] .context-menu{background:var(--panel);border-color:var(--edge);box-shadow:0 18px 50px #000a}
html[data-theme="dark"] .context-menu button{background:transparent;border-color:transparent;color:var(--ink)}
html[data-theme="dark"] .context-menu button:hover{background:var(--raised)}
html[data-theme="dark"] .context-menu .menu-separator{border-color:var(--edge)}
html[data-theme="dark"] .context-menu .swatch{border-color:var(--panel)}
html[data-theme="dark"] .context-menu .danger{color:#e08a7f}
html[data-theme="dark"] .context-menu .danger:hover{background:#3a2522}
.text-button{display:block;width:100%}
#resistor-value{width:100%;border:1px solid var(--edge);border-radius:5px;padding:7px;margin:6px 0 4px;color:var(--ink)}
.resistor-band-preview{display:flex;flex-wrap:wrap;align-items:center;gap:6px;font-size:11px;color:var(--muted);margin:6px 0 4px}
.resistor-band-swatch{display:inline-block;width:16px;height:16px;border-radius:50%;border:1px solid var(--edge);flex:none}
#generic-resistor-dialog form{display:flex;flex-direction:column;gap:8px}
#generic-resistor-dialog input{width:100%;border:1px solid var(--edge);border-radius:5px;padding:9px;color:var(--ink);font-size:13px}
#generic-resistor-dialog .help{margin:0}
