.fastener-overlay[hidden],.fastener-placement[hidden]{display:none!important}
.fastener-overlay{position:fixed;inset:0;z-index:1600;display:grid;place-items:center;background:#101b2c66;padding:22px;color:#25364a;font-size:13px}
.fastener-dialog{width:min(1220px,96vw);max-height:92vh;background:#f8fafc;border:1px solid #97a8bd;border-radius:9px;box-shadow:0 20px 70px #101b2c55;display:flex;flex-direction:column;overflow:hidden}
.fastener-dialog header{padding:12px 16px;display:flex;align-items:center;justify-content:space-between;background:#e8eef5;border-bottom:1px solid #c4cfdd;font-size:15px}
.fastener-dialog header button{font-size:20px;min-width:30px}
.fastener-content{display:flex;min-height:450px;min-width:0;overflow:auto}
.fastener-content nav{width:205px;flex:none;border-right:1px solid #cbd5e1;background:#f0f4f8;padding:10px;display:flex;flex-direction:column;gap:3px}
.fastener-content nav input{width:100%;margin-bottom:8px;box-sizing:border-box}
.fastener-content nav button{display:flex;align-items:center;justify-content:space-between;text-align:left;padding:9px 8px;border-color:transparent;background:transparent;gap:6px}
.fastener-content nav button[hidden]{display:none}
.fastener-content nav button[aria-pressed=true]{background:#dceafa;border-color:#8db5e4;color:#104d8d;font-weight:600}
.fastener-content nav small{color:#718299}
.fastener-content main{flex:1;min-width:0;padding:14px;display:flex;flex-direction:column}
.fastener-content h3{margin:0 0 6px;font-size:14px;font-weight:600}
.fastener-preview{height:170px;flex:none;background:#fff;border:1px solid #dae1ea;border-radius:4px}
.fastener-preview svg{width:100%;height:100%}
.fastener-hint{min-height:34px;margin:9px 0;line-height:1.4;color:#40546e;font-size:12px}
.fastener-table-wrap{overflow:auto;min-height:140px;max-height:34vh;border:1px solid #becad9;background:#fff}
.fastener-overlay table{border-collapse:collapse;min-width:100%;font-size:12px}
.fastener-overlay th{background:#e9eff6;padding:8px 5px;font-weight:500;white-space:nowrap;position:sticky;top:0}
.fastener-overlay td{border:1px solid #d3dce8;padding:3px;white-space:nowrap}
.fastener-overlay tr[aria-selected=true]{background:#e0efff}
.fastener-overlay input{font:inherit;padding:6px;border:1px solid #bbc8d8;border-radius:3px;box-sizing:border-box;background:#fff;color:#243a52}
.fastener-overlay td input{width:62px;min-width:45px}
.fastener-overlay td .fastener-name{width:210px}
.fastener-overlay input[type=color]{width:36px;padding:2px;height:28px}
.fastener-overlay button,.fastener-placement button{border:1px solid #b4c2d3;border-radius:4px;background:#fff;color:#25364a;font:inherit;padding:6px 10px;cursor:pointer}
.fastener-overlay button:disabled{opacity:.45;cursor:default}
.fastener-overlay button:hover:not(:disabled),.fastener-placement button:hover{background:#edf4fc}
.fastener-overlay button.primary{background:#1768ad;border-color:#1768ad;color:white}
.fastener-overlay :focus-visible,.fastener-placement :focus-visible{outline:2px solid #2489df;outline-offset:1px}
.fastener-overlay footer{display:flex;justify-content:space-between;gap:12px;padding:12px 14px;border-top:1px solid #c4cfdd;flex-wrap:wrap}
.fastener-overlay footer>div{display:flex;gap:6px;flex-wrap:wrap}
.fastener-note{font-size:11px;color:#64758a;margin:8px 0}
.fastener-error{color:#b42434;min-height:20px;white-space:normal}
.fastener-subeditor{position:absolute;inset:0;background:#17253666;display:grid;place-items:center;padding:20px}
.fastener-subeditor>section{background:#f8fafc;padding:20px;width:min(680px,90vw);max-height:85vh;overflow:auto;border-radius:8px;box-shadow:0 12px 40px #0004}
.fastener-subeditor td input{width:100%}
.fastener-placement{position:fixed;left:66px;bottom:39px;z-index:65;width:min(730px,calc(100vw - 400px));padding:12px 14px;border:1px solid #9bb6d3;border-radius:7px;background:#f5f9ffed;box-shadow:0 5px 22px #16355c26;color:#20394f;font-size:12px}
.fastener-placement strong{display:block;margin-bottom:5px}
.fastener-step{display:block;margin-bottom:8px}
.fastener-placement-fields{display:flex;flex-wrap:wrap;align-items:center;gap:7px}
.fastener-placement label{display:flex;align-items:center;gap:4px}
.fastener-placement input:not([type=checkbox]){width:59px;padding:5px;border:1px solid #aabbd0;border-radius:3px;font:inherit}
.fastener-placement-error{display:block;min-height:16px;margin-top:7px;color:#ad2430}
@media(max-width:800px){.fastener-overlay{padding:6px}.fastener-dialog{max-height:97vh}.fastener-content nav{width:148px;padding:6px}.fastener-content main{padding:8px}.fastener-content{min-height:350px}.fastener-placement{left:50px;right:10px;width:auto;bottom:30px}.fastener-dialog footer{padding:8px}}
.fastener-placement{box-sizing:border-box}
.fastener-placement-error{color:#425a74}
.fastener-placement-error[data-invalid=true]{color:#ad2430}
.fastener-preview{display:flex;height:212px}
.fastener-preview>.fastener-dimension-sketch{width:55%;height:100%;border-right:1px solid #d9e2ee}
.fastener-live-preview{width:45%;min-width:0;display:grid;place-items:center}
.fastener-dimension-sketch .panel{fill:url(#fastener-hatch)}
.fastener-dimension-sketch .bore{fill:white;stroke:#245fda}
.fastener-dimension-sketch .dimension{stroke:#245fda;marker-start:url(#fastener-arrow);marker-end:url(#fastener-arrow)}
.fastener-dimension-sketch text{font:italic 12px sans-serif;fill:#245fda;stroke:none}
.fastener-dimension-sketch .joint{stroke:#2b70db;stroke-dasharray:4 3}
/* The four library categories share one header and an attached tab strip. */
.fastener-tabs{display:flex;gap:5px;padding:0 16px;background:#e8eef5;border-bottom:1px solid #b8c9dc;flex:none}
.fastener-tabs button{position:relative;display:flex;align-items:center;gap:8px;padding:12px 18px 13px;margin-bottom:-1px;border:1px solid transparent;border-bottom-color:#b8c9dc;border-radius:8px 8px 0 0;background:transparent;color:#53677e;font-weight:600;white-space:nowrap}
.fastener-tabs button[aria-selected=true]{background:#f8fafc;border-color:#b8c9dc;border-bottom-color:#f8fafc;color:#125e9c;box-shadow:inset 0 3px #297fc2}
.fastener-tabs button:disabled{opacity:1;color:#9aa7b6;cursor:default}
.fastener-tabs button:disabled small{font-size:10px;font-weight:400;color:#8493a6;background:#dfe6ee;border-radius:10px;padding:2px 6px}
.fastener-tab-icon{font-size:18px;line-height:1;color:inherit}
.fastener-dialog header{border-bottom:0;padding-bottom:16px}
.scheme-content main{gap:10px;max-height:70vh;overflow:auto}
.scheme-content nav{width:205px}
.scheme-content nav button.scheme-deleted{color:#9ca3af;text-decoration:line-through}
.scheme-heading{display:grid;grid-template-columns:1fr 260px;gap:18px}
.scheme-heading label{display:grid;gap:6px;font-size:12px;color:#51647a}
.scheme-heading input,.scheme-heading select{font-size:13px;width:100%;height:32px;border:1px solid #bac9da;border-radius:4px;padding:5px 8px;background:white;color:#25364a}
.scheme-preview{height:130px;border:1px solid #d7e1ec;border-radius:6px;background:white;padding:6px 12px;flex:none}
.scheme-preview svg{width:100%;height:100%}
.scheme-preview svg text{font:11px sans-serif;fill:#536b83}
.scheme-preview-controls{display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:11px;color:#687d93}
.scheme-preview-controls input{width:65px;padding:4px}
.scheme-preview-controls>span{display:flex;align-items:center;gap:6px}
.scheme-preview-controls i{display:inline-block;width:8px;height:8px;border-radius:50%;background:#267bc3;margin-left:8px}
.scheme-preview-controls i.additional{background:#d68a27;border-radius:1px}
.scheme-columns{display:grid;grid-template-columns:minmax(290px,1fr) 260px;gap:18px}
.scheme-furniture{display:flex;align-items:center;gap:6px;margin-bottom:8px;font-size:12px}
.scheme-furniture>span{width:148px;flex:none;color:#53677e}
.scheme-furniture button:first-of-type{flex:1;display:flex;align-items:center;justify-content:space-between;gap:8px;text-align:left;min-width:0}
.scheme-furniture b{font-size:16px;font-weight:400;color:#3979aa}
.scheme-columns fieldset{border:1px solid #d6e0eb;border-radius:6px;padding:10px 12px;margin:14px 0 10px;min-width:0}
.scheme-columns legend{padding:0 5px;color:#3c5e7f;font-size:12px}
.scheme-field{display:flex;align-items:center;justify-content:space-between;gap:15px;font-size:12px;margin:7px 0}
.scheme-field>span:last-child{display:flex;align-items:center;gap:6px;flex:none}
.scheme-field input{width:70px;text-align:right}
.scheme-field small{width:20px;color:#7a8b9d}
.scheme-checkbox{display:flex;align-items:center;gap:7px;font-size:12px;color:#5d6f82;margin:8px 0}
.scheme-columns details{font-size:12px;color:#526b83}.scheme-columns summary{cursor:pointer;padding:5px 0}
.scheme-quantity{padding:0 0 0 16px;border-left:1px solid #dde5ee}
.scheme-quantity h4{font-size:12px;margin:0 0 5px;color:#334f6d}
.scheme-quantity p{font-size:11px;line-height:1.5;color:#697d92;margin:5px 0 10px}
.scheme-table{max-height:230px;overflow:auto;margin-bottom:8px;background:white;border:1px solid #cbd8e5;border-radius:4px}
.scheme-table input{width:100%!important;min-width:35px!important}
.scheme-table td:last-child{width:24px}.scheme-table button{padding:4px 6px}
.scheme-empty{min-height:300px;display:grid;place-items:center;color:#667e96}
@media(max-width:1100px){.scheme-content nav{width:165px}.scheme-columns{grid-template-columns:minmax(240px,1fr) 210px;gap:10px}.scheme-furniture>span{width:118px}.scheme-heading{grid-template-columns:1fr 220px}.fastener-tabs button{padding:11px 12px;gap:6px}.fastener-tabs button small{display:none}}
@media(max-width:800px){.fastener-tabs{padding:0 8px;gap:0;overflow:auto}.fastener-tabs button{font-size:11px;padding:10px 8px}.scheme-columns{grid-template-columns:1fr}.scheme-quantity{border-left:0;border-top:1px solid #dde5ee;padding:12px 0 0}.scheme-heading{grid-template-columns:1fr}.scheme-preview-controls{flex-wrap:wrap}.scheme-content main{max-height:66vh}}
.fastener-dialog>header,.fastener-dialog>footer{flex:none}
.fastener-content{min-height:0;flex:1 1 auto}
.fastener-placement select{max-width:330px;min-width:130px;padding:5px 7px;border:1px solid #b4c2d3;border-radius:4px;background:#fff;color:#25364a;font:inherit}
.fastener-placement button.primary{background:#1768ad;border-color:#1768ad;color:#fff}
.fastener-joint-toolbar { display:flex; align-items:center; gap:4px; margin-left:auto; flex-shrink:1; min-width:0; }
.fastener-joint-toolbar[hidden], .joint-tool-button[hidden] { display:none; }
.fastener-joint-toolbar:not([hidden]) + .toolbar-designation-search { margin-left:4px; }
.joint-tool-button { min-width:30px; display:flex; align-items:center; gap:5px; padding:3px 6px; white-space:nowrap; }
.joint-tool-button svg { width:22px; height:22px; flex-shrink:0; fill:#dce6ec; stroke:#485d6b; stroke-width:1.3; }
.joint-tool-button .joint-icon-mark { fill:none; stroke:#278840; stroke-width:2; }
.joint-tool-button[aria-pressed="true"] { background:#d3e8ff; border-color:#72aaf1; color:#164b82; }
.joint-command-properties { font-size:12px; color:#26374b; padding-bottom:16px; }
.joint-command-title { font-weight:700; background:#e7edf4; border-bottom:1px solid #b8c9da; padding:10px 8px; }
.joint-property { display:grid; grid-template-columns:minmax(120px,1fr) minmax(90px,1fr); gap:8px; align-items:center; min-height:30px; padding:3px 9px; border-bottom:1px dotted #dce3eb; }
.joint-property > div { min-width:0; overflow-wrap:anywhere; }
.joint-property select { width:100%; min-width:0; }
.joint-scheme-choice { display:flex; gap:3px; }
.joint-scheme-choice button { flex-shrink:0; }
.joint-command-properties button, .joint-property select, .joint-property input[type="number"] { border:1px solid #b6c7db; border-radius:3px; background:#fff; color:inherit; padding:5px 7px; font:inherit; }
.joint-command-properties button:hover:not(:disabled) { background:#e4f0ff; }
.joint-command-properties button:disabled { opacity:.45; cursor:default; }
.joint-command-actions { display:grid; grid-template-columns:1fr 1fr; gap:7px; padding:12px 9px 5px; }
.joint-command-actions .primary { background:#1468b3; color:white; border-color:#1468b3; }
.joint-command-actions .primary:hover:not(:disabled) { background:#0f5796; }
.joint-command-hint { margin:8px 9px; color:#63748b; line-height:1.45; }
.joint-selection-actions { display:flex; gap:6px; padding:0 9px; }
.joint-hover { padding:6px 9px; color:#315c87; min-height:26px; }
.joint-command-error { color:#ad341e; padding:0 9px 6px; line-height:1.4; }
.joint-command-error:empty { display:none; }
.joint-command-properties summary { cursor:pointer; font-weight:600; padding:8px 9px; background:#f0f4f8; }
.joint-property input[type="color"] { width:40px; height:24px; border:1px solid #b6c7db; padding:1px; }
.joint-property input[type="number"] { width:72px; }
@media(max-width:1700px) { .joint-tool-button span { display:none; } }
