:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  --bg: #101318;
  --panel: #15191f;
  --panel-light: #1b2028;
  --line: #292f38;
  --text: #e8eaf0;
  --muted: #a1aab8;
  --faint: #828d9d;
  --accent: #f5a45c;
  --teal: #65d9c4;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--bg); }
button, input, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button { border: 0; background: none; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
[data-icon] { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; }
[data-icon] svg { width: 18px; height: 18px; }
.topbar { height: 68px; display: flex; justify-content: space-between; align-items: center; padding: 0 24px; border-bottom: 1px solid var(--line); background: #12161b; }
.brand, .top-actions { display: flex; align-items: center; gap: 12px; }
.brand-icon { width: 39px; height: 39px; background: var(--accent); color: #201710; border-radius: 9px; }
.brand-icon svg { width: 25px; height: 25px; }
.brand strong { font-size: 19px; letter-spacing: -.45px; display: block; line-height: 1.15; }
.brand div > span { font: 10px var(--mono); letter-spacing: .13em; color: var(--muted); }
.button { min-height: 37px; border: 1px solid var(--line); border-radius: 7px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 600; text-decoration: none; }
.button.primary { background: var(--accent); border-color: transparent; color: #201710; }
.button.primary:hover { background: #ffb976; }
.button.muted { width: 37px; padding: 0; color: var(--muted); }
.button.muted:hover { background: var(--panel-light); color: var(--text); }
.workspace { display: grid; grid-template-columns: minmax(215px, 248px) minmax(0, 1fr) minmax(258px, 310px); height: calc(100dvh - 68px); }
.library, .inspector { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--panel); }
.library { border-right: 1px solid var(--line); }
.inspector { border-left: 1px solid var(--line); }
.library-top { padding: 22px 15px 13px; }
.eyebrow { color: var(--faint); font: 600 11px var(--mono); letter-spacing: .14em; }
.board-label { display: block; font-size: 14px; margin: 15px 0 7px; color: var(--muted); }
.board-picker, .search-box { display: flex; align-items: center; position: relative; height: 41px; border: 1px solid #343c47; border-radius: 7px; background: #11151a; }
.board-picker > span { pointer-events: none; position: absolute; right: 8px; color: var(--muted); }
.board-picker .board-icon { left: 9px; right: auto; color: var(--accent); }
.board-picker select { appearance: none; border: 0; background: transparent; width: 100%; padding: 0 30px 0 36px; height: 100%; border-radius: 6px; font-size: 14px; font-weight: 600; }
option { background: var(--panel); }
.source { color: var(--accent); font-size: 12px; margin: 8px 0 17px; min-height: 16px; overflow-wrap: anywhere; }
.source::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; vertical-align: 2px; margin-right: 7px; }
.board-identity { display: grid; gap: 4px 8px; grid-template-columns: auto 1fr; margin: -9px 0 14px; font-size: 11px; }
.board-identity[hidden] { display: none; }
.board-identity dt { color: var(--muted); }
.board-identity dd { margin: 0; font-family: var(--mono); overflow-wrap: anywhere; }
.search-box { gap: 7px; padding: 0 8px; color: var(--muted); }
.search-box:focus-within { border-color: var(--accent); }
.search-box input { width: 100%; min-width: 0; border: 0; background: transparent; height: 100%; color: var(--text); font-size: 14px; outline: none; }
.search-box input:focus-visible { outline: none; }
kbd { font: 11px var(--mono); background: #212630; border: 1px solid #343c47; color: var(--muted); padding: 2px 5px; border-radius: 4px; }
.tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding: 0 15px; gap: 0 12px; }
.tabs button { min-height: 40px; color: var(--muted); padding: 0 2px; border-bottom: 2px solid transparent; font-size: 14px; }
.tabs button.active { color: var(--accent); border-color: var(--accent); }
.list-top, .pin-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 15px 8px; color: var(--muted); font-size: 12px; }
.list-top select { border: 1px solid var(--line); border-radius: 5px; padding: 4px; color: var(--muted); background: #11151a; font-size: 12px; }
.results, .inspector-body { overflow: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: #3a424d transparent; }
.results { flex: 1; padding: 0 8px 10px; }
.result { display: grid; grid-template-columns: 27px minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; min-height: 43px; padding: 4px 7px; border: 1px solid transparent; border-radius: 6px; text-align: left; }
.result:hover, .pin-row:hover, .endpoint:hover { background: #20252d; }
.result[aria-current=true] { background: #2a211d; border-color: #614630; }
.result-mark { display: grid; place-items: center; width: 27px; height: 26px; background: #222a34; color: #9daec0; font: 600 11px var(--mono); border-radius: 5px; }
.result[aria-current=true] .result-mark { color: var(--accent); background: #3e2e23; }
.result strong, .result small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result strong { font: 600 13px var(--mono); }
.result small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.result-side { color: var(--faint); font: 10px var(--mono); }
.list-more { display: block; width: 100%; padding: 9px 7px; color: var(--accent); font-size: 12px; }
.list-more:hover { background: var(--panel-light); }
.viewer { display: grid; grid-template-rows: auto minmax(0, 1fr) 34px; min-width: 0; min-height: 0; background: #13171d; }
.viewer-head { padding: 19px 21px 15px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.viewer-head h1 { font-size: clamp(19px, 2.2vw, 28px); margin: 3px 0 0; letter-spacing: -.035em; line-height: 1.2; overflow-wrap: anywhere; }
.segmented { display: flex; align-items: center; background: #101318; border: 1px solid var(--line); border-radius: 7px; padding: 3px; gap: 3px; }
.segmented button { border-radius: 4px; min-width: 49px; height: 32px; font-size: 13px; color: var(--muted); }
.segmented button[aria-pressed=true] { background: #33261e; color: var(--accent); }
.viewport { position: relative; min-height: 0; min-width: 0; margin: 0 14px; border: 1px solid #333a45; border-radius: 10px; overflow: hidden; background-color: #0d1117; background-image: radial-gradient(#2a323e 1px, transparent 1px); background-size: 19px 19px; background-position: center; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
canvas.dragging { cursor: grabbing; }
.canvas-top, .canvas-bottom { position: absolute; pointer-events: none; display: flex; align-items: center; }
.canvas-top { top: 13px; left: 13px; gap: 7px; padding: 7px 8px; background: #141a22; border: 1px solid #2e3642; border-radius: 5px; color: #b7c0ce; font: 600 11px var(--mono); }
.canvas-top[hidden] { display: none; }
.live-dot { background: var(--teal); width: 6px; height: 6px; border-radius: 50%; }
.canvas-actions { top: 13px; right: 13px; position: absolute; display: grid; border: 1px solid #343c47; border-radius: 7px; overflow: hidden; background: #181d24; }
.canvas-actions button { width: 36px; height: 36px; color: #c0c8d4; }
.canvas-actions button + button { border-top: 1px solid #343c47; }
.canvas-actions button:hover { color: var(--accent); background: #2c2520; }
.canvas-bottom { bottom: 13px; left: 13px; right: 13px; justify-content: space-between; gap: 7px; }
.legend { display: flex; flex-wrap: wrap; gap: 11px; padding: 7px 8px; border: 1px solid #2e3642; border-radius: 5px; background: #141a22; color: #b7c0ce; font-size: 11px; }
.legend span { display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.legend span[hidden] { display: none; }
.legend i { width: 7px; height: 7px; border-radius: 2px; }
.legend .other-side { border: 1px dashed #91c7ff; }
.legend .schematic-link { border: 1px dashed var(--teal); }
.copper { background: #bb9b5d; }
.selected { background: var(--accent); }
.traced { background: var(--teal); }
.scale { max-width: 40%; border-bottom: 1px solid #a1aab8; font: 10px var(--mono); padding-bottom: 3px; text-align: center; white-space: nowrap; min-width: 35px; color: #abb5c1; text-shadow: 0 1px #111; }
.viewer-foot { display: flex; justify-content: space-between; align-items: center; padding: 0 19px; gap: 10px; font: 11px var(--mono); color: var(--muted); }
.inspector-head { display: flex; gap: 9px; align-items: center; padding: 16px; border-bottom: 1px solid var(--line); }
.inspector-head > span, .inspector-foot > span { color: var(--accent); }
.inspector-head h2 { font-size: 16px; margin: 0; }
.inspector-body { flex: 1; }
.detail { margin: 14px; padding: 12px; border: 1px solid #523c2d; border-radius: 8px; background: #211d1c; }
.detail.net-detail { border-color: #355449; background: #192523; }
.detail-top { display: flex; justify-content: space-between; gap: 7px; align-items: flex-start; }
.detail h3 { margin: 0; color: var(--accent); font: 700 19px var(--mono); overflow-wrap: anywhere; min-width: 0; }
.net-detail h3 { color: var(--teal); font-size: 14px; }
.detail p { color: var(--muted); margin: 8px 0; font-size: 14px; line-height: 1.43; overflow-wrap: anywhere; }
.detail p:last-child { margin-bottom: 0; }
.detail-meta { color: #c2a68f; font-size: 12px; margin-top: 5px; }
.net-detail .detail-meta { color: #a4c4bc; }
.net-detail .net-coverage { font-size: 12px; }
.net-flip { border: 1px solid #48678c; border-radius: 5px; padding: 5px 8px; color: #a9d2ff; font-size: 12px; }
.net-flip:hover { background: #293c52; }
.sheet-links { display: grid; gap: 4px; margin-top: 9px; color: var(--muted); font-size: 12px; }
.sheet-links a { color: #ffd0a5; text-underline-offset: 3px; overflow-wrap: anywhere; }
.sheet-list { color: var(--muted); margin-top: 9px; font-size: 12px; }
.sheet-list summary { cursor: pointer; }
.close-detail { color: var(--muted); padding: 0; height: 22px; }
.pin-head { border-top: 1px solid var(--line); text-transform: uppercase; font: 11px var(--mono); letter-spacing: .08em; }
.pin-row, .endpoint { display: flex; justify-content: space-between; padding: 7px 9px; width: 100%; align-items: center; text-align: left; gap: 8px; min-height: 33px; color: #c7cdd7; border-radius: 5px; font: 12px var(--mono); }
.pin-row span:first-child, .endpoint span:first-child { color: var(--accent); }
.pin-row span, .endpoint span { overflow-wrap: anywhere; min-width: 0; }
.pin-row[aria-pressed=true] { background: #203731; color: var(--teal); }
.pin-row[aria-pressed=true] span:first-child { color: var(--teal); }
.pins, .endpoints { padding: 0 8px 8px; }
.inspector-foot { display: flex; gap: 9px; padding: 13px 15px; border-top: 1px solid var(--line); align-items: flex-start; font-size: 14px; }
.options { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 7px; color: var(--muted); font-size: 13px; }
.options label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.options input { accent-color: var(--accent); margin: 0; }
.empty { color: var(--muted); padding: 12px 10px; line-height: 1.5; font-size: 14px; }
.inspector-body > .empty { padding: 18px 15px; }
.notice { position: absolute; z-index: 2; left: 50%; bottom: 50px; transform: translateX(-50%); width: max-content; max-width: 74%; padding: 10px 13px; border: 1px solid #634933; border-radius: 7px; color: #ffe0c0; background: #30251d; font-size: 14px; overflow-wrap: anywhere; }
dialog { color: var(--text); background: var(--panel); border: 1px solid #3b4350; border-radius: 10px; width: min(480px, calc(100% - 28px)); padding: 18px; }
dialog::backdrop { background: #080b10b8; }
.dialog-head, .shortcuts div { display: flex; align-items: center; justify-content: space-between; }
.dialog-head h2 { margin: 0; font-size: 19px; }
dialog p { font-size: 15px; line-height: 1.5; color: var(--muted); }
.shortcuts div { padding: 5px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 1000px) {
  .workspace { grid-template-columns: 190px minmax(0, 1fr) 235px; }
  .viewer-head { padding-inline: 13px; }
  .viewport { margin-inline: 8px; }
}
@media (max-width: 760px) {
  .topbar { padding-inline: 12px; }
  .workspace { height: auto; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .viewer { grid-column: 1 / -1; grid-row: 1; height: clamp(350px, 63dvh, 560px); }
  .library, .inspector { border-top: 1px solid var(--line); height: 480px; }
  .inspector { border-left: 0; }
  .list-top { gap: 5px; padding-inline: 8px; }
  .library-top, .tabs { padding-inline: 9px; }
  .legend { gap: 6px; }
}
@media (max-width: 365px) {
  .canvas-hint, .brand div > span { display: none; }
  .brand { gap: 6px; }
  .brand strong { font-size: 16px; }
  .top-actions { gap: 6px; }
}
.connections { margin: 0 12px 10px; border: 1px solid var(--line); border-radius: 6px; }
.connections summary { cursor: pointer; padding: 8px; font-size: 13px; color: var(--teal); }
.connections .endpoints { max-height: 236px; overflow: auto; }
.viewer-foot #coords { white-space: nowrap; }
