:root {
  --bg: #b8c0ca;
  --chrome: #1b222b;
  --chrome-2: #232b34;
  --chrome-3: #2d3642;
  --chrome-line: #10141a;
  --chrome-hover: #3a4554;
  --ink-on-dark: #e8edf3;
  --muted-on-dark: #9bb0c2;
  --panel: #f4f6f9;
  --panel-2: #e8edf3;
  --line: #c5ccd6;
  --line-strong: #a8b2be;
  --text: #1a222c;
  --muted: #5c6776;
  --accent: #0b6cb8;
  --accent-2: #0a5a98;
  --accent-soft: #d7ebfa;
  --on-fill: #cfe6f8;
  --ok: #2f9e62;
  --ok-2: #247a4c;
  --warn: #c9a227;
  --danger: #b33a3a;
  --sch: #f7f3e8;
  --pcb: #1a4a32;
  --sheet: #fffdf6;
  --radius: 4px;
  --radius-lg: 6px;
  --space: 8px;
  --font: "Segoe UI", Tahoma, Arial, sans-serif;
  --shadow-pop: 0 10px 28px rgba(12, 16, 22, .32);
  --shadow-card: 0 1px 2px rgba(20, 28, 38, .08), 0 6px 16px rgba(20, 28, 38, .06);
  --focus: 0 0 0 2px #fff, 0 0 0 4px var(--accent);
  --focus-dark: 0 0 0 2px rgba(126, 196, 255, .95);
  --ctrl-border: #b0b8c2;
  --ctrl-face: linear-gradient(#fff, #f3f5f8);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  font-family: var(--font); font-size: 12px; line-height: 1.35;
  color: var(--text); background: var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { color: var(--text); }
button:disabled, select:disabled, input:disabled {
  opacity: .42; cursor: default; pointer-events: none;
}
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); outline: none; }
.top :focus-visible,
.menu-btn:focus-visible,
.menu-pop button:focus-visible,
.cv-tools button:focus-visible,
.zoom-hud button:focus-visible,
.top-restore button:focus-visible,
.top-compact-hide:focus-visible,
.btn-save-progress:focus-visible,
.doc-title:focus-visible {
  box-shadow: var(--focus-dark);
}

#app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) 22px;
  height: 100%;
  min-width: 960px;
}

/* —— 1. brand —— */
.top {
  background: var(--chrome);
  color: var(--ink-on-dark);
  border-bottom: 1px solid var(--chrome-line);
  box-shadow: 0 1px 0 rgba(255,255,255,.045) inset;
}
.brand-row {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 10px 2px;
  min-height: 32px;
}
.brand {
  font-weight: 700; font-size: 13px; letter-spacing: .06em;
  color: #7ec4ff; cursor: pointer; user-select: none;
  text-shadow: 0 1px 0 rgba(0,0,0,.35);
  flex-shrink: 0;
}
.brand:hover { color: #c4e4ff; }
.doc-title {
  flex: 1; min-width: 120px; font: inherit; font-size: 12px;
  color: #c5d0dc; background: transparent;
  border: 1px solid transparent; border-radius: var(--radius);
  padding: 4px 8px;
}
.doc-title:hover { border-color: #3d4652; background: #151b22; }
.doc-title:focus { border-color: #4f8ec4; background: #12171d; outline: 0; color: #fff; }
.brand-meta {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.btn-save-progress {
  flex-shrink: 0;
  height: 26px;
  background: linear-gradient(#3d8f63, var(--ok-2));
  color: #f3fff8;
  border: 1px solid #1e5c3a;
  border-radius: var(--radius);
  padding: 0 12px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  letter-spacing: .02em;
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset;
}
.btn-save-progress:hover { background: linear-gradient(#48a472, #2f9e62); }
.btn-save-progress:active { background: var(--ok-2); }
.btn-save-progress.flash { background: #7ee0a8; color: #06210f; border-color: #52b788; }
.autosave { color: #8fd19e; font-size: 11px; white-space: nowrap; }
.autosave.flash-saved { color: #d8ffe6; }
.sess-lab {
  color: var(--muted-on-dark); font-size: 11px; white-space: nowrap;
  max-width: 220px; overflow: hidden; text-overflow: ellipsis;
  padding: 0 2px;
}
.top-compact-hide {
  flex-shrink: 0; height: 26px;
  background: var(--chrome-3); color: var(--muted-on-dark);
  border: 1px solid #45515f;
  border-radius: var(--radius); padding: 0 9px; cursor: pointer; font: inherit;
}
.top-compact-hide:hover { color: var(--ink-on-dark); background: var(--chrome-hover); border-color: #5a6778; }
.top-compact-hide:active { background: #1a2028; }

.top-restore {
  display: none; align-items: center; gap: 8px;
  height: 28px; padding: 0 8px;
  background: var(--chrome); border-bottom: 1px solid var(--chrome-line);
}
.top-restore::before {
  content: "ARMCAD-EDA";
  font-weight: 700; font-size: 11px; letter-spacing: .05em;
  color: #7ec4ff; margin-right: 4px;
}
.top-restore button {
  height: 22px;
  background: var(--chrome-3); color: var(--ink-on-dark);
  border: 1px solid #4a5564;
  border-radius: var(--radius); padding: 0 10px; cursor: pointer; font: inherit;
}
.top-restore button:hover { background: var(--chrome-hover); }
#app.hide-top-menu .brand-row,
#app.hide-top-menu .menu,
#app.hide-top-menu .ribbon { display: none; }
#app.hide-top-menu .top-restore { display: flex; }
#app.hide-top-menu .top { border-bottom: 0; }
#app.hide-ribbon .ribbon { display: none; }

/* —— 2. menus —— */
.menu { display: flex; padding: 0 6px 2px; gap: 0; }
.menu-drop { position: relative; }
.menu-btn, .menu-pop button {
  background: transparent; color: var(--ink-on-dark); border: 0;
  padding: 4px 11px; cursor: pointer; font: inherit; text-align: left; width: 100%;
}
.menu-btn { width: auto; border-radius: var(--radius); height: 24px; padding: 0 10px; }
.menu-btn:hover, .menu-drop.open .menu-btn { background: var(--chrome-hover); }
.menu-pop {
  display: none; position: absolute; top: 100%; left: 0; min-width: 280px; z-index: 40;
  background: #323a44; border: 1px solid #12161c; border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 4px 0; box-shadow: var(--shadow-pop);
}
.menu-drop.open .menu-pop { display: block; }
.menu-pop button { padding: 6px 14px; }
.menu-pop button:hover { background: #4a5564; }
.menu-pop button:disabled { opacity: .4; cursor: default; }
.menu-sep { height: 1px; margin: 4px 10px; background: #4a5562; }

/* —— 3. ribbon —— */
.ribbon {
  display: flex; gap: 0; padding: 3px 6px 5px;
  background: linear-gradient(#eef1f5, #dfe4ea);
  color: var(--text);
  flex-wrap: wrap;
  border-top: 1px solid #3a424c;
}
.ribbon .grp {
  display: flex; gap: 3px; align-items: flex-end; flex-wrap: wrap;
  border-right: 1px solid var(--line-strong);
  padding: 0 8px 0 6px;
}
.ribbon .grp:last-child { border-right: 0; }
.grp-lab {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .06em; margin-right: 2px; align-self: center; font-weight: 700;
}
.ribbon button, .ribbon select {
  font: inherit; padding: 4px 8px; border: 1px solid var(--ctrl-border);
  background: var(--ctrl-face);
  border-radius: var(--radius); cursor: pointer;
  box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;
}
.ribbon select { height: 36px; max-width: 148px; }
.ribbon select:hover, .ribbon .pcb-size input:hover { border-color: #8aa3bd; }
.ribbon select:focus, .ribbon .pcb-size input:focus {
  border-color: var(--accent); outline: 0;
  box-shadow: 0 0 0 3px rgba(11,108,184,.16);
}
.ribbon .tool-btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-width: 54px; min-height: 44px; padding: 4px 5px 3px;
  font-size: 10px; line-height: 1.15; color: #243040;
}
.ribbon .ico {
  width: 18px; height: 18px; stroke: currentColor; fill: none;
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.ribbon .ico .ico-fill { fill: currentColor; stroke: none; }
.ribbon button:hover { background: #fff; border-color: #8aa3bd; }
.ribbon button:active { background: #e4edf6; }
.ribbon button:disabled { opacity: .4; cursor: default; filter: none; }
.ribbon button.primary {
  background: linear-gradient(#1a86d4, var(--accent-2));
  color: #fff; border-color: #095a9a;
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset;
}
.ribbon button.primary:hover { filter: brightness(1.06); }
.ribbon button.on {
  background: var(--on-fill);
  color: #073a63;
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(11, 108, 184, .25);
}
.ribbon button.on:hover { background: #bddcf4; }
.ribbon .pcb-size {
  display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--muted);
  padding: 0 4px 4px; white-space: nowrap;
}
.ribbon .pcb-size input {
  width: 52px; padding: 4px 5px; font: inherit;
  border: 1px solid var(--ctrl-border); border-radius: var(--radius); background: #fff;
}

/* —— 4. workspace —— */
.ws {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr) 280px;
  grid-template-rows: minmax(0, 1fr);
  gap: 6px;
  min-height: 0; height: 100%;
  padding: 6px;
  background: #aeb6c0;
}
#app.hide-left .ws { grid-template-columns: 28px minmax(0, 1fr) 280px; }
#app.hide-right .ws { grid-template-columns: 256px minmax(0, 1fr) 28px; }
#app.hide-left.hide-right .ws { grid-template-columns: 28px minmax(0, 1fr) 28px; }
#app.hide-ribbon .ribbon { display: none; }

.side, .props, .props-col {
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  min-height: 0;
}
.side, .props-col {
  display: flex; flex-direction: column; overflow: hidden;
  padding: 0; min-width: 0;
}
.side-body {
  display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden;
}
.props-col .props {
  flex: 1; min-height: 0; border: 0; box-shadow: none; border-radius: 0;
}
.edge-tab {
  display: none;
  flex: 1;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  align-items: center; justify-content: center;
  gap: 0;
  border: 0; margin: 0; padding: 8px 0;
  background: var(--chrome);
  color: var(--ink-on-dark);
  cursor: pointer; font: inherit; font-size: 11px; font-weight: 700;
  letter-spacing: .06em;
}
.edge-tab:hover { background: var(--chrome-hover); color: #7ec4ff; }
#app.hide-left .side .edge-tab,
#app.hide-right .props-col .edge-tab { display: flex; }
#app.hide-left .side-body { display: none; }
#app.hide-right .props-col .props { display: none; }
#app.hide-left .side,
#app.hide-right .props-col {
  background: var(--chrome);
  border-color: var(--chrome-line);
  box-shadow: none;
}
.side-block {
  display: flex; flex-direction: column; min-height: 0;
}
.side-block:first-child {
  max-height: 38%;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.side-block:first-child #tree { overflow: auto; flex: 1; }
.side-block.grow { flex: 1; overflow: hidden; }
.side-block.grow #lib { flex: 1; overflow: auto; }

.side h3, .props h3 {
  margin: 0;
  padding: 7px 10px;
  font-size: 11px; font-weight: 700;
  color: #0a4f86;
  text-transform: uppercase; letter-spacing: .05em;
  background: linear-gradient(#f7f9fb, #eef1f5);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 2;
}
.lib-head {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(#f7f9fb, #eef1f5);
  border-bottom: 1px solid var(--line);
  padding-right: 8px;
}
.lib-head h3 { border-bottom: 0; background: transparent; flex: 1; }

.icon-btn {
  width: 24px; height: 24px; border: 1px solid var(--line-strong);
  background: #fff; border-radius: var(--radius);
  cursor: pointer; font: inherit; line-height: 1; color: var(--accent);
}
.icon-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.icon-btn:active { background: var(--on-fill); }

#libSearch {
  margin: 8px; width: calc(100% - 16px); font: inherit;
  padding: 6px 8px 6px 28px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%235c6776' stroke-width='1.6'><circle cx='6' cy='6' r='4.2'/><path d='M9.2 9.2 L12 12'/></svg>") no-repeat 8px 50%;
}
#libSearch:hover { border-color: #8aa3bd; }
#libSearch:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px rgba(11,108,184,.18); }
#libSearch::placeholder { color: #8a94a3; }
.lib-hint {
  margin: 0 8px 6px;
  font-size: 10px;
  line-height: 1.35;
  color: #5c6776;
}

.lib-group-h {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  font-size: 11px; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: .03em;
  cursor: pointer; user-select: none;
  border-bottom: 1px solid #e2e7ee;
}
.lib-group-h:hover, .lib-fam-h:hover { background: #e8eef4; }
.lib-group.open > .lib-group-h { background: #e3eef8; }
.chev {
  display: inline-block; width: 0; height: 0; flex-shrink: 0;
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  border-left: 6px solid var(--accent);
  transition: transform .16s ease;
}
.lib-group.open > .lib-group-h .chev,
.lib-fam.open > .lib-fam-h .chev { transform: rotate(90deg); }
.cnt { margin-left: auto; font-weight: 600; opacity: .55; font-size: 10px; }
.lib-drop { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .2s ease; }
.lib-drop-inner { overflow: hidden; min-height: 0; }
.lib-group.open > .lib-group-drop,
.lib-fam.open > .lib-fam-drop { grid-template-rows: 1fr; }
.lib-fam-h {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 22px; font-size: 11px; color: var(--muted);
  cursor: pointer; user-select: none;
}
.lib-fam-h .chev { border-left-color: var(--muted); }
.lib-item {
  padding: 6px 12px 6px 28px; cursor: grab;
  border-bottom: 1px solid #e6eaef;
}
.lib-item:hover { background: #e8f0fc; }
.lib-item:active { cursor: grabbing; }
.lib-item.on { background: var(--on-fill); box-shadow: inset 3px 0 0 var(--accent); }
.lib-item .tag {
  display: inline-block; font-size: 9px; background: #d9e8c8; color: #2a5a1a;
  padding: 0 4px; border-radius: 2px; margin-left: 4px; vertical-align: middle;
}
.lib-item .tag:last-of-type:not(:first-of-type) { background: #dce8f8; color: #1a4a78; }
.lib-item small { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
#lib .msg { padding: 16px 12px; text-align: center; }

.tree-node {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; cursor: pointer; user-select: none;
  border-left: 3px solid transparent;
}
.tree-node:hover { background: #e8f0fc; }
.tree-node.on {
  background: var(--on-fill);
  border-left-color: var(--accent);
  font-weight: 600;
}
.tree-node .mark { width: 16px; text-align: center; color: var(--accent); flex-shrink: 0; }
.tree-node .tree-lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-node.child { padding-left: 28px; font-size: 12px; font-weight: 400; color: #334155; }

.props { border-right: 0; padding: 0 0 12px; overflow: auto; }
.props > h3 { margin-bottom: 0; }
.props > .field, .props > .msg, .props > .actions, .props > .comp-row,
.props > p, .props > pre, .props > canvas, .props > .lyr-row {
  margin-left: 10px; margin-right: 10px;
}

.stage {
  position: relative; min-width: 0; min-height: 0; height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  background: #8e98a4;
  border: 1px solid #6f7884;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), var(--shadow-card);
}
.stage[data-mode="sch"] { background: #9aa3ad; }
.stage[data-mode="pcb"] { background: #3d4a44; }
canvas { display: block; }
#c {
  position: relative;
  width: 100%; height: 100%;
  min-width: 0; min-height: 0;
  justify-self: stretch; align-self: stretch;
  cursor: default;
  z-index: 0;
}

/* document tabs — top CAD strip; sheets live in .page-bar at the bottom */
.stage-chrome {
  position: absolute; left: 0; right: 0; top: 0; z-index: 6;
  display: flex; align-items: flex-end; gap: 10px;
  pointer-events: none;
  padding: 0 8px;
  height: 40px;
  background: linear-gradient(to bottom, rgba(28, 34, 42, .42), rgba(28, 34, 42, .08) 70%, transparent);
}
.stage-chrome > * { pointer-events: auto; }

.tabs, .doc-tabs {
  display: flex; align-items: flex-end; gap: 0;
}
.tabs button, .doc-tabs button {
  font: inherit; padding: 6px 14px 7px;
  border: 1px solid #7d8692; border-bottom: 0;
  background: linear-gradient(#e4e7ec, #cfd4db);
  border-radius: 6px 6px 0 0;
  cursor: pointer; color: #2a3340;
  margin-right: -1px;
  box-shadow: 0 1px 0 rgba(255,255,255,.55) inset;
}
.tabs button:hover, .doc-tabs button:hover { background: #eef1f5; }
.tabs button:active, .doc-tabs button:active { background: #d8dee6; }
.tabs button.on[data-tab="sch"],
.doc-tabs button.on[data-tab="sch"] {
  background: var(--sch);
  border-color: #b7aa86;
  color: #3a3324;
  font-weight: 700;
  z-index: 1;
  padding-bottom: 8px;
}
.tabs button.on[data-tab="pcb"],
.doc-tabs button.on[data-tab="pcb"] {
  background: var(--pcb);
  border-color: #0d2e1e;
  color: #e8f5ee;
  font-weight: 700;
  z-index: 1;
  padding-bottom: 8px;
}

.page-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; align-items: center; gap: 4px;
  padding: 5px 10px 6px;
  min-height: 36px;
  max-height: 40px;
  box-sizing: border-box;
  overflow-x: auto;
  pointer-events: auto;
  background: linear-gradient(to top, rgba(28, 34, 42, .5), rgba(28, 34, 42, .12) 72%, transparent);
}
.page-bar-lbl {
  color: #111;
  font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
  margin: 0 6px 0 0; white-space: nowrap;
  background: var(--sch);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #d4ccb4;
  font-weight: 700;
}
.page-tab {
  min-width: 28px; height: 24px; padding: 0 8px;
  border: 1px solid #b8b09a;
  background: linear-gradient(#fffef8, #ebe4ce);
  color: #3a3528;
  border-radius: 4px;
  cursor: pointer; font: inherit; font-size: 11px; line-height: 22px;
  box-shadow: 0 1px 0 #fff inset, 1px 2px 4px rgba(0,0,0,.12);
}
.page-tab:hover { background: #fff; }
.page-tab:active { background: #f3ecd4; }
.page-tab.active {
  background: var(--sheet);
  color: #1a2230;
  border-color: #c9a200;
  font-weight: 700;
  height: 26px;
  box-shadow: 0 0 0 1px rgba(201, 162, 0, .35), 0 2px 6px rgba(0,0,0,.12);
}
.page-tab.page-add,
.page-tab.page-del {
  min-width: 24px; font-weight: 700;
  background: linear-gradient(#f4f6f8, #dfe4ea);
  border-color: #8a929c; color: #243040;
}
.page-tab.page-add:hover { background: #fff; border-color: var(--accent); color: var(--accent); }
.page-tab.page-del { color: var(--danger); }
.page-tab.page-del:hover { background: #fdecec; border-color: var(--danger); }
.stage[data-mode="pcb"] .page-bar,
.page-bar[hidden] { display: none; }

/* glass overlays on canvas — same chrome family as header */
.cv-tools, .zoom-hud {
  background: rgba(27, 34, 43, .88);
  backdrop-filter: blur(12px) saturate(1.12);
  -webkit-backdrop-filter: blur(12px) saturate(1.12);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 8px 22px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.08);
}
.cv-tools {
  position: absolute; left: 8px; top: 48px; z-index: 5;
  display: flex; flex-direction: column; gap: 2px; padding: 4px;
  border-radius: 8px;
}
.cv-tools button, .zoom-hud button {
  width: 30px; height: 28px; padding: 0;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(50, 58, 68, .72);
  color: var(--ink-on-dark); border-radius: var(--radius); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font: inherit;
}
.cv-tools button:hover, .zoom-hud button:hover {
  background: rgba(74, 86, 100, .95);
  border-color: rgba(255,255,255,.22);
}
.cv-tools button:active, .zoom-hud button:active { background: #1a2028; }
.cv-tools button.on, .zoom-hud button.on {
  background: var(--accent);
  border-color: #7ec4ff;
  color: #fff;
  box-shadow: 0 0 0 1px rgba(126, 196, 255, .35);
}
.cv-tools button.on:hover { background: #1a86d4; }
.cv-tools .ico {
  width: 16px; height: 16px; stroke: currentColor; fill: none;
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.cv-tools .ico .ico-fill { fill: currentColor; stroke: none; }
.cv-sep { height: 1px; margin: 3px 4px; background: rgba(255,255,255,.16); }

.zoom-hud {
  position: absolute; right: 10px; bottom: 10px; z-index: 7;
  display: flex; align-items: center; gap: 3px; padding: 4px 5px;
  border-radius: 8px;
}
.stage[data-mode="sch"] .zoom-hud { bottom: 48px; }
.zoom-hud button { width: 26px; height: 24px; font-size: 14px; line-height: 1; }
.zoom-hud #zoomPct {
  min-width: 48px; text-align: center; color: var(--ink-on-dark); font-size: 11px;
  font-variant-numeric: tabular-nums; user-select: none;
}
.zoom-hud .zoom-fit { font-size: 12px; }
.zoom-hud .zoom-kbd {
  font-size: 9px; color: var(--muted-on-dark); padding: 0 4px 0 2px;
  letter-spacing: .02em; user-select: none; white-space: nowrap;
}

/* —— 5. status —— */
.status {
  background: var(--chrome-2); color: #a9b6c4;
  font-size: 11px; padding: 0 12px;
  display: flex; align-items: center; gap: 12px;
  border-top: 1px solid var(--chrome-line);
}
.status > span { white-space: nowrap; }
#statusLeft { color: #d5dee8; overflow: hidden; text-overflow: ellipsis; }
.status-mid { flex: 1; color: #7e8c9c; overflow: hidden; text-overflow: ellipsis; }
.status-zoom {
  font-variant-numeric: tabular-nums; color: #c5d0dc;
  padding: 0 8px; border-left: 1px solid #3d4652; border-right: 1px solid #3d4652;
}
.status-ports { color: #7e8c9c; }

.field { margin: 8px 0; }
.field label {
  display: block; font-size: 11px; color: var(--muted);
  margin-bottom: 4px; font-weight: 600;
}
.field input, .field select, .field textarea {
  width: 100%; font: inherit; padding: 6px 8px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: #fff;
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: #8aa3bd; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); outline: 0;
  box-shadow: 0 0 0 3px rgba(11,108,184,.16);
}
.field textarea { min-height: 80px; resize: vertical; line-height: 1.4; }
.field textarea[readonly] {
  background: #eef2f6;
  color: var(--muted);
  cursor: default;
  resize: none;
}
.field input[type="number"] { font-variant-numeric: tabular-nums; }
.pdf-check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.pdf-check input { width: auto; margin: 0; }
.align-btns { display: flex; flex-wrap: wrap; gap: 4px; }
.align-btns button {
  font: inherit; font-size: 11px; padding: 4px 8px; cursor: pointer;
  border: 1px solid var(--line-strong); background: #fff; border-radius: var(--radius);
}
.align-btns button:hover { border-color: #8aa3bd; }
.align-btns button.on {
  background: #0b6cb8; color: #fff; border-color: #095a9a;
}
.msg { font-size: 12px; color: var(--muted); line-height: 1.45; margin: 8px 10px; }
#sfSize, #pSheetMm { color: #0a4f86; font-weight: 600; }
.plot { width: calc(100% - 20px); height: 140px; background: #111; border-radius: var(--radius); margin: 8px 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 10px; }
.actions button, .pdf-actions button, .pdf-row button, .fw-tabs button,
.fmt-grid button, .fmt-btn, .sheet-dlg button, .page-fmt-dlg button {
  font: inherit; padding: 5px 10px; cursor: pointer;
  border: 1px solid var(--ctrl-border); background: var(--ctrl-face);
  border-radius: var(--radius);
}
.actions button:hover, .pdf-actions button:hover, .pdf-row button:hover, .fw-tabs button:hover,
.fmt-grid button:hover, .fmt-btn:hover {
  border-color: #8aa3bd; background: #fff;
}
.actions button.primary, .pdf-actions button.primary, button.primary {
  background: linear-gradient(#1a86d4, var(--accent-2));
  color: #fff; border-color: #095a9a;
}
.actions button.primary:hover, .pdf-actions button.primary:hover { filter: brightness(1.05); }
pre.net {
  font-size: 11px; background: #fff; border: 1px solid var(--line);
  padding: 8px; max-height: 220px; overflow: auto; border-radius: var(--radius);
  margin: 8px 10px;
}
.lyr-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; font-size: 12px;
  border-radius: var(--radius); margin: 2px 10px;
}
.lyr-row:hover { background: #e8eef4; }
.lyr-dot {
  width: 14px; height: 10px; border: 1px solid #333; flex-shrink: 0;
  border-radius: 2px;
}
.lyr-row.active { font-weight: 700; background: var(--on-fill); }
.lyr-row.dim { opacity: .45; }
.lyr-row button {
  font: inherit; padding: 3px 8px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; border-radius: var(--radius);
}
.lyr-row button:hover { border-color: var(--accent); }
.drc-bad { color: var(--danger); margin: 8px 10px; }
.drc-ok { color: var(--ok); margin: 8px 10px; }

.modal-bg {
  position: fixed; inset: 0; background: rgba(16, 20, 26, .52);
  display: flex; align-items: center; justify-content: center; z-index: 80;
  backdrop-filter: blur(2px);
}
.pdf-dlg, .sheet-dlg, .page-fmt-dlg {
  width: min(480px, 94vw); background: var(--panel);
  border: 1px solid #8a929c; border-radius: 8px;
  padding: 0 16px 16px; box-shadow: var(--shadow-pop);
}
.pdf-dlg h3, .sheet-dlg h3, .page-fmt-dlg h3 {
  margin: 0 -16px 10px; padding: 12px 16px;
  font-size: 13px; background: linear-gradient(#f7f9fb, #eef1f5);
  border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0;
  color: #0a4f86; font-weight: 700; letter-spacing: .02em;
}
.pdf-row, .fmt-grid, .orient-row {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.fmt-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0 0 8px;
}
.fmt-btn, .pdf-row [data-fmt], .fmt-grid [data-fmt], .sheet-dlg [data-fmt] {
  min-height: 36px;
  font-weight: 700;
  letter-spacing: .04em;
  background: linear-gradient(#fffef8, #ebe4ce);
  border-color: #b8b09a;
  color: #3a3528;
}
.fmt-btn:hover, .pdf-row [data-fmt]:hover, .fmt-grid [data-fmt]:hover {
  background: #fff; border-color: #c9a200;
}
.pdf-row button.on, .fw-tabs button.on,
.fmt-btn.on, .fmt-btn.active, .fmt-grid button.on, .fmt-grid button.active,
.pdf-row [data-fmt].on, .sheet-dlg [data-fmt].on {
  background: var(--sheet);
  color: #1a2230;
  border-color: #c9a200;
  font-weight: 700;
  box-shadow: 0 0 0 1px rgba(201, 162, 0, .35);
}
.pdf-actions, .dlg-actions {
  display: flex; gap: 6px; justify-content: flex-end; margin-top: 12px;
}
.pdf-dlg.wide, .sheet-dlg.wide { width: min(640px, 96vw); max-height: 90vh; overflow: auto; }

.help-dlg {
  width: min(1100px, 96vw);
  height: min(86vh, 820px);
  background: var(--panel);
  border: 1px solid #8a929c;
  border-radius: 8px;
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.help-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(#1b222b, #232b34);
  border-bottom: 1px solid var(--chrome-line);
  color: var(--ink-on-dark);
}
.help-head h3 {
  margin: 0; font-size: 13px; flex: 0 0 auto;
  color: #7ec4ff; letter-spacing: .03em; font-weight: 700;
}
.help-head #helpSearch {
  flex: 1; min-width: 120px;
  border: 1px solid #45515f; border-radius: var(--radius);
  padding: 6px 10px; background: #151b22; color: var(--ink-on-dark);
}
.help-head #helpSearch::placeholder { color: #7e8c9c; }
.help-head #helpSearch:focus {
  border-color: #4f8ec4; outline: 0;
  box-shadow: var(--focus-dark);
}
.help-head #helpClose {
  font: inherit; padding: 5px 12px; cursor: pointer; height: 28px;
  border: 1px solid #45515f; background: var(--chrome-3);
  color: var(--ink-on-dark); border-radius: var(--radius);
}
.help-head #helpClose:hover { background: var(--chrome-hover); }
.help-body { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 0; flex: 1; }
.help-toc {
  overflow: auto; border-right: 1px solid var(--line);
  padding: 8px 0; background: var(--panel-2);
}
.help-toc a {
  display: block; padding: 5px 12px; color: #1a3a58; text-decoration: none;
  border-left: 3px solid transparent;
}
.help-toc a:hover { background: var(--accent-soft); }
.help-toc a:focus-visible { box-shadow: none; background: var(--on-fill); border-left-color: var(--accent); }
.help-toc a.lv3 { padding-left: 22px; font-size: 11px; color: var(--muted); }
.help-article {
  overflow: auto; padding: 12px 20px 28px;
  background: #fff;
}
.help-article h1 { font-size: 18px; margin: 0 0 12px; color: #1a222c; }
.help-article h2 { font-size: 15px; margin: 22px 0 8px; padding-top: 4px; border-top: 1px solid #e6eaef; color: #0a4f86; }
.help-article h3 { font-size: 13px; margin: 16px 0 6px; color: #073a63; }
.help-article p, .help-article li { line-height: 1.45; }
.help-article table {
  border-collapse: collapse; width: 100%; margin: 8px 0 14px; font-size: 12px;
}
.help-article th, .help-article td {
  border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top;
}
.help-article th { background: #eef1f5; }
.help-article code {
  background: #eef1f5; padding: 1px 5px; border-radius: 3px; font-size: 11px;
}
.help-article mark.help-hit { background: #ffe566; padding: 0 1px; }
.help-article hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.pdf-dlg.fw { width: min(780px, 96vw); max-height: 92vh; overflow: auto; }
.fw-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.fw-code {
  width: 100%; min-height: 220px; font: 12px/1.4 Consolas, "Courier New", monospace;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 8px;
  background: #1e2228; color: #e8edf3;
}
.fw-plot { width: 100%; height: 160px; }
.lib-prev { width: 100%; height: 128px; background: var(--sch); border: 1px solid var(--line); display: block; border-radius: var(--radius); }
.comp-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid #e6eaef; font-size: 12px;
  margin-left: 10px; margin-right: 10px;
}
.comp-row button {
  font: inherit; padding: 3px 8px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; border-radius: var(--radius);
}
.comp-row button:hover { border-color: #8aa3bd; }

.side-block:first-child #tree::-webkit-scrollbar,
#lib::-webkit-scrollbar,
.props::-webkit-scrollbar,
.help-toc::-webkit-scrollbar,
.help-article::-webkit-scrollbar {
  width: 8px;
}
.side-block:first-child #tree::-webkit-scrollbar-thumb,
#lib::-webkit-scrollbar-thumb,
.props::-webkit-scrollbar-thumb,
.help-toc::-webkit-scrollbar-thumb,
.help-article::-webkit-scrollbar-thumb {
  background: #b0b8c2; border-radius: 4px;
}
.side-block:first-child #tree::-webkit-scrollbar-track,
#lib::-webkit-scrollbar-track,
.props::-webkit-scrollbar-track,
.help-toc::-webkit-scrollbar-track,
.help-article::-webkit-scrollbar-track { background: transparent; }
