.graph-content { min-width: 0; }
.network-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; padding: .35rem max(.75rem, calc((100% - 98rem) / 2)); background: var(--green-dark); color: white; }
.toolbar-group { display: flex; gap: .15rem; border-right: 1px solid #ffffff80; padding-right: .35rem; }
.network-toolbar .toolbar-group button, .toolbar-text, .toolbar-menu summary { background: transparent; color: white; border: 0; border-radius: var(--button-radius); font: inherit; cursor: pointer; }
.network-toolbar .toolbar-group button { display: grid; place-items: center; width: 2.2rem; height: 2.05rem; padding: .25rem; }
.network-toolbar .toolbar-group button img { width: 1.45rem; height: 1.45rem; object-fit: contain; }
.network-toolbar button[aria-pressed="true"], .network-toolbar button:hover:not(:disabled), .toolbar-menu[open] summary, .toolbar-menu summary:hover { background: var(--green-deep); }
#graph-calculate { background: var(--green-deep); }
.network-toolbar [data-mode][aria-pressed="true"] { box-shadow: inset 0 -3px #fff; }
#active-network-mode { padding: 0 .35rem; font-size: .85rem; white-space: nowrap; }
.network-toolbar :focus-visible { outline-color: white; outline-offset: -2px; }
.network-toolbar button:disabled { opacity: .42; cursor: default; }
.toolbar-menu { position: relative; }
.toolbar-text, .toolbar-menu summary { padding: .3rem .5rem; }
.toolbar-menu-items { position: absolute; inset-inline-start: 0; top: 100%; min-width: max-content; z-index: 20; display: grid; padding: .25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--button-radius); box-shadow: 0 4px 12px #0002; }
.network-toolbar .toolbar-menu-items button { width: 100%; padding: .35rem .6rem; text-align: left; font-weight: 400; color: var(--ink); background: var(--surface); }
.network-toolbar .toolbar-menu-items button:hover:not(:disabled), .network-toolbar .toolbar-menu-items button:focus-visible { background: var(--green-light); outline-color: var(--green-dark); }
#network-mode[hidden] { display: none; }
.editor-with-inspector { grid-template-columns: 11rem minmax(0, 1fr) 17rem; }
main:has(.editor-with-inspector) { max-width: 100rem; }
.network-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .75rem; max-width: 31rem; margin-bottom: .75rem; }
#calculation-warnings { color: #8a3300; }
.graph-hint { margin: .5rem 0; font-size: .9rem; }
.graph-toolbar [data-kind] { border-left: 4px solid var(--green); cursor: grab; }
.graph-toolbar [data-kind] { display: flex; align-items: center; gap: .4rem; padding: .45rem .5rem; overflow-wrap: anywhere; background: var(--surface); }
.graph-toolbar [data-kind]:hover:not(:disabled) { background: var(--green-light); }
.graph-toolbar [data-kind] img { flex: 0 0 28px; width: 28px; height: 28px; object-fit: contain; }
.graph-toolbar h3 { margin: 0; font-size: 1rem; }
.graph-toolbar summary { cursor: pointer; font-size: .9rem; font-weight: 600; padding: .25rem .45rem; background: var(--surface-muted); }
.graph-toolbar details small { line-height: 1.25; padding: .3rem 0; }
.graph-scroll { overflow: auto; border: 1px solid var(--border); }
#graph-board {
  width: max(960px, 100%);
  height: 560px;
  position: relative;
  background: radial-gradient(#b6b6b6 1px, transparent 1px) 0 0 / 16px 16px #fafafa;
}
#graph-wires { position: absolute; width: 100%; height: 100%; pointer-events: none; }
#graph-wires line { stroke: var(--menu); stroke-width: 2; }
.graph-node { position: absolute; width: 150px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--green); border-radius: var(--button-radius); padding: .3rem .4rem; }
.graph-node[data-active="true"] { border-color: var(--green-dark); outline: 2px solid var(--green-dark); background: var(--green-light); }
.graph-heading { display: flex; justify-content: space-between; align-items: center; gap: .2rem; }
.graph-node .handle { display: flex; align-items: center; gap: .25rem; padding: .15rem; background: transparent; color: var(--ink); cursor: grab; text-align: left; touch-action: none; font-size: .875rem; }
.graph-node .handle img { width: 35px; height: 35px; object-fit: contain; }
.graph-node .remove { padding: .15rem .35rem; background: transparent; color: var(--ink); }
.graph-node .port { width: 20px; height: 20px; transform: translateY(-50%); }
.graph-node .port-in { left: -12px; }
.graph-node .port-out { right: -12px; }
.graph-node { min-height: 48px; }
.graph-node small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#graph-board.hide-details .node-caption, #graph-board.hide-names .node-name { visibility: hidden; }
.node-readings:empty, .node-warning[hidden] { display: none; }
.node-readings { color: var(--green-deep); font-size: .78rem; }
.node-warning { position: absolute; width: 18px; height: 18px; right: 3px; bottom: 3px; color: #854200; }
#graph-board.hide-warnings .node-warning { display: none; }
.property-panel { min-width: 0; align-self: start; border: 1px solid var(--border); border-top: 3px solid var(--green); background: var(--surface); }
.property-panel h3 { margin: 0; padding: .55rem .75rem; font-size: 1rem; border-bottom: 1px solid var(--border); }
.property-panel > p { margin: .75rem; font-size: .9rem; }
.property-heading { display: flex; align-items: center; gap: .5rem; padding: .65rem .75rem; background: var(--surface-muted); }
.property-heading img { width: 42px; height: 42px; object-fit: contain; }
#property-connections { font-size: .85rem; }
#property-controls { max-height: 28rem; overflow-y: auto; padding: .6rem .75rem; }
#property-controls label { display: block; font-size: .875rem; font-weight: 600; }
#property-controls input, #property-controls select { padding: .3rem .5rem; }
@media (max-width: 70rem) {
  .editor-with-inspector { grid-template-columns: 9rem minmax(0, 1fr) 14rem; }
}
@media (max-width: 58rem) {
  .editor-with-inspector { grid-template-columns: 10rem minmax(0, 1fr); }
  .property-panel { grid-column: 2; }
}
@media (max-width: 42rem) {
  .editor-with-inspector { grid-template-columns: minmax(0, 1fr); }
  .property-panel { grid-column: 1; }
}
.graph-results { margin-top: 1rem; }
.graph-materials { margin-top: 1rem; }
.graph-table { overflow-x: auto; }
.graph-table table, .print-only table { width: 100%; border-collapse: collapse; }
.graph-table th, .graph-table td, .print-only th, .print-only td { padding: .4rem; border-bottom: 1px solid var(--border); text-align: left; }
.graph-table caption { text-align: left; font-weight: 600; padding: .75rem .4rem .25rem; }
.print-only { display: none; }
@media print {
  .graph-panel, .network-toolbar { display: none; }
  .print-only { display: block; }
  .graph-table { overflow: visible; }
  #printed-network { display: block; width: 100%; max-height: 190px; }
}
