* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, 'Segoe UI', Roboto, sans-serif; background: #14161a; color: #e8e8e8; height: 100vh; overflow: hidden; }
#app { display: flex; flex-direction: column; height: 100vh; }
#topbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; background: #1d2026; border-bottom: 1px solid #2c313a; }
.brand { font-size: 16px; }
.brand .sub { font-size: 12px; opacity: .6; margin-left: 8px; }
.top-actions { display: flex; gap: 8px; }
.btn { background: #2c313a; color: #e8e8e8; border: 1px solid #3a4150; border-radius: 8px; padding: 7px 14px; cursor: pointer; font-size: 14px; }
.btn:hover { background: #363c48; }
.btn.primary { background: #f5b81e; color: #14161a; font-weight: 600; border-color: #f5b81e; }
.btn.primary:hover { background: #ffc93d; }
#main { display: flex; flex: 1; min-height: 0; }
#toolbar { width: 52px; background: #1d2026; border-right: 1px solid #2c313a; display: flex; flex-direction: column; align-items: center; padding: 8px 0; gap: 6px; }
.tool { width: 38px; height: 38px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: #e8e8e8; font-size: 18px; cursor: pointer; }
.tool:hover { background: #2c313a; }
.tool.active { background: #f5b81e; color: #14161a; }
.tb-sep { width: 60%; height: 1px; background: #2c313a; margin: 4px 0; }
#canvas-wrap { flex: 1; position: relative; overflow: hidden; background: #22252b; }
#canvas { position: absolute; top: 0; left: 0; cursor: crosshair; }
#hint { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: rgba(29,32,38,.92); padding: 8px 16px; border-radius: 10px; font-size: 13px; border: 1px solid #3a4150; max-width: 80%; text-align: center; pointer-events: none; }
#scale-badge { position: absolute; bottom: 12px; left: 12px; background: rgba(29,32,38,.92); padding: 6px 12px; border-radius: 8px; font-size: 12px; border: 1px solid #3a4150; }
#scale-badge.ok { border-color: #58c322; color: #9be36e; }
#sidebar { width: 300px; background: #1d2026; border-left: 1px solid #2c313a; display: flex; flex-direction: column; padding: 10px; overflow-y: auto; }
#sidebar h3 { font-size: 13px; text-transform: uppercase; opacity: .7; margin: 6px 0; }
.m-item { background: #24272e; border: 1px solid #2c313a; border-radius: 8px; padding: 8px; margin-bottom: 6px; font-size: 13px; }
.m-item .m-head { display: flex; align-items: center; gap: 6px; }
.m-item .m-color { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.m-item input.m-name { flex: 1; background: transparent; border: none; color: #e8e8e8; font-size: 13px; border-bottom: 1px dashed transparent; }
.m-item input.m-name:focus { outline: none; border-bottom-color: #f5b81e; }
.m-item .m-val { font-weight: 600; color: #f5b81e; white-space: nowrap; }
.m-item .m-del { background: none; border: none; color: #888; cursor: pointer; font-size: 14px; }
.m-item .m-del:hover { color: #ff6b6b; }
#totals { margin-top: 10px; border-top: 1px solid #2c313a; padding-top: 8px; }
#totals-body { font-size: 13px; }
#totals-body div { display: flex; justify-content: space-between; padding: 3px 0; }
#totals-body b { color: #f5b81e; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #1d2026; border: 1px solid #3a4150; border-radius: 12px; padding: 18px; min-width: 320px; }
#modal-title { font-weight: 600; margin-bottom: 10px; }
#modal-body input { width: 100%; padding: 8px; background: #24272e; border: 1px solid #3a4150; border-radius: 8px; color: #e8e8e8; font-size: 14px; margin: 6px 0; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
@media (max-width: 760px) { #sidebar { width: 200px; } }
