:root { color-scheme: light; --bg: #f3f5f8; --fg: #1b2733; --muted: #62707e; --line: #cfd6de; --accent: #0b3d91; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.4 system-ui, sans-serif; color: var(--fg); background: var(--bg); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
button, input { font: inherit; }
.tool { padding: 6px 12px; min-height: 36px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; }
.tool:disabled { opacity: .5; cursor: default; }
.tool[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.tool:focus-visible, input:focus-visible, .lib-el:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.editor-page { display: flex; flex-direction: column; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: #fff; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.topbar .spacer { flex: 1; }
.back { color: var(--accent); text-decoration: none; }
.project-name { max-width: 30ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-state { color: var(--muted); min-width: 9ch; text-align: right; }
.save-state[data-state="error"] { color: #b3261e; font-weight: 600; }
.save-state[data-state="conflict"] { color: #b3261e; font-weight: 600; }
.banner { display: flex; align-items: center; gap: 12px; padding: 8px 12px; }
.banner[hidden] { display: none; }
.banner-warn { background: #fff3cd; border-bottom: 1px solid #e0c46c; }
.banner-error { background: #fde7e7; border-bottom: 1px solid #e0a0a0; }
.layout { flex: 1; display: grid; grid-template-columns: 260px 1fr 240px; min-height: 0; }
.panel { background: #fff; padding: 10px; overflow: auto; border-right: 1px solid var(--line); }
.panel-props { border-right: 0; border-left: 1px solid var(--line); }
.panel h2 { margin: 0 0 8px; font-size: 15px; }
.panel input[type="search"], .panel input[type="text"] { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.panel label { display: block; margin: 8px 0 4px; }
.muted { color: var(--muted); }
.lib-root { margin-top: 8px; }
.lib-tree details > details, .lib-tree details > ul { margin-left: 12px; }
.lib-tree summary { cursor: pointer; padding: 3px 0; }
.lib-list { list-style: none; padding: 0; margin: 4px 0; }
.lib-el { display: block; width: 100%; text-align: left; padding: 6px 8px; margin: 2px 0; border: 1px solid var(--line); border-radius: 6px; background: #f8fafc; cursor: grab; }
.lib-empty { color: var(--muted); padding: 4px 0; }
.lib-error { color: #b3261e; padding: 4px 0; }
.canvas-wrap { position: relative; min-width: 0; min-height: 0; background: #dfe4ea; }
.field { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; }
.field.mode-rail { cursor: crosshair; }
.field.mode-pan { cursor: grab; }
.field.mode-panning { cursor: grabbing; }
.field .item, .field .rail { cursor: move; }
.field .item-nominal, .field .item-label { pointer-events: none; font-family: system-ui, sans-serif; }
.field .sel rect, .field .sel .item-body { stroke: #d32f2f; stroke-width: 1.2; }
.not-found { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font-size: 20px; background: var(--bg); }
.not-found[hidden] { display: none; }
@media (max-width: 800px) { .layout { grid-template-columns: 1fr; grid-template-rows: 180px 1fr 120px; } .panel { border: 0; border-bottom: 1px solid var(--line); } }
.plain-page { display: block; height: auto; min-height: 100vh; }
.card { max-width: 380px; margin: 12vh auto 0; padding: 20px 24px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.card.wide { max-width: 720px; margin-top: 24px; }
.card h1 { font-size: 20px; margin: 0 0 12px; }
.card label { display: block; margin: 10px 0 4px; }
.card input[type="text"], .card input[type="password"] { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 6px; }
.card button[type="submit"] { margin-top: 14px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.row input { flex: 1; width: auto; }
.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.danger { color: #b3261e; border-color: #e0a0a0; }
.form-error { color: #b3261e; margin: 8px 0 0; }
.form-error[hidden], .muted[hidden] { display: none; }
.plist { list-style: none; margin: 12px 0 0; padding: 0; }
.plist li { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.plist .pname { flex: 1; color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
.plist .pname:hover { text-decoration: underline; }
.dlg { border: 1px solid var(--line); border-radius: 10px; max-width: 420px; }
.field .port { cursor: crosshair; }
.field .port-dot { fill: #fff; stroke: #0b3d91; stroke-width: 0.6; }
.field .port:hover .port-dot, .field .port.hot .port-dot { fill: #ffb300; }
.field-hint, .field-toast { position: absolute; left: 50%; transform: translateX(-50%); margin: 0; padding: 6px 12px; border-radius: 6px; pointer-events: none; max-width: 90%; text-align: center; }
.field-hint { bottom: 10px; background: rgba(255,255,255,.9); color: var(--muted); border: 1px solid var(--line); }
.field-toast { bottom: 52px; background: #fff3cd; border: 1px solid #e0c46c; color: var(--fg); }
.field-toast[hidden] { display: none; }
.field .wire { cursor: pointer; }
.field .wire.sel polyline.wire-line { stroke-width: 1.6; }
.field .wire-hit { stroke: transparent; fill: none; stroke-width: 4; }
.field.mode-wire { cursor: crosshair; }
.field .wire-label { pointer-events: none; font-family: system-ui, sans-serif; }
.props-sep { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.panel select { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.project-name { padding: 4px 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; font-weight: 700; width: 24ch; }
.project-name:hover, .project-name:focus { border-color: var(--line); background: #fff; }

.lib-el { display: flex; gap: 8px; align-items: center; }
.lib-thumb { flex: none; width: 36px; height: 36px; object-fit: contain; background: #fff; border-radius: 4px; }
.lib-thumb-empty { display: inline-block; background: #d5dae0; }
.lib-text { display: flex; flex-direction: column; min-width: 0; }
.lib-nominal { overflow-wrap: anywhere; }
.lib-origin { font-size: 0.8em; color: var(--muted); }
