:root {
  color-scheme: light;
  --ink: #0a0a0b;
  --muted: #6a6a70;
  --line: rgba(12, 12, 14, 0.12);
  --line-strong: rgba(12, 12, 14, 0.22);
  --paper: #f6f6f3;
  --paper-2: #ffffff;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-dark: rgba(8, 8, 9, 0.7);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.14);
  --shadow-tight: 0 12px 36px rgba(0, 0, 0, 0.13);
  --radius: 8px;
  --topbar: 68px;
  --left: 282px;
  --right: 324px;
  --grid: 24px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(238, 238, 233, 0.95)),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.025) 0 1px, transparent 1px 64px);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--left) minmax(0, 1fr) var(--right);
  grid-template-rows: var(--topbar) minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  padding: 12px;
  gap: 12px;
}

.glass-panel,
.floating-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.42)),
    rgba(255, 255, 255, 0.48);
  box-shadow: var(--shadow-tight);
  backdrop-filter: blur(26px) saturate(1.35);
  -webkit-backdrop-filter: blur(26px) saturate(1.35);
}

.glass-panel::before,
.floating-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.78), transparent 34%),
    linear-gradient(300deg, transparent 62%, rgba(255, 255, 255, 0.5));
  opacity: 0.7;
}

.topbar {
  z-index: 10;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  overflow: visible;
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 50%;
  color: #fff;
  background:
    radial-gradient(circle at 34% 22%, rgba(255, 255, 255, 0.42), transparent 28%),
    #080808;
  font-size: 12px;
  font-weight: 740;
  letter-spacing: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 10px 24px rgba(0, 0, 0, 0.22);
}

h1,
h2,
p {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1;
  letter-spacing: 0;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.toolbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  flex-wrap: wrap;
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: rgba(0, 0, 0, 0.16);
}

.menu-wrap {
  position: relative;
}

.app-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 50%;
  display: grid;
  min-width: 156px;
  padding: 6px;
  border-color: rgba(0, 0, 0, 0.09);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(250, 250, 248, 0.9)),
    rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.16);
  transform: translateX(-50%);
}

.app-menu::before {
  opacity: 0.28;
}

.app-menu button {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: #111;
  background: transparent;
  font-size: 12px;
  font-weight: 760;
  text-align: left;
}

.app-menu button:hover {
  background: rgba(0, 0, 0, 0.08);
}

.menu-separator {
  position: relative;
  z-index: 1;
  display: block;
  height: 1px;
  margin: 5px 6px;
  background: rgba(0, 0, 0, 0.12);
}

.icon-button,
.text-button,
.mini-button,
.template-button,
.full-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.35)),
    rgba(255, 255, 255, 0.44);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.icon-button:hover,
.text-button:hover,
.mini-button:hover,
.template-button:hover,
.full-button:hover {
  transform: translateY(-1px);
  border-color: rgba(0, 0, 0, 0.28);
  background: rgba(255, 255, 255, 0.75);
}

.icon-button:active,
.text-button:active,
.mini-button:active,
.template-button:active,
.full-button:active {
  transform: translateY(0);
}

.icon-button {
  width: 36px;
  height: 34px;
  line-height: 1;
}

.tabler-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button .tabler-icon {
  width: 19px;
  height: 19px;
}

.text-button .tabler-icon,
.app-menu .tabler-icon {
  width: 16px;
  height: 16px;
}

.icon-button.tiny {
  width: 28px;
  height: 28px;
  font-size: 14px;
}

.text-button {
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 680;
}

.text-button[data-menu-button]::after {
  content: "";
  width: 6px;
  height: 6px;
  margin: -3px 0 0 2px;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  opacity: 0.64;
  transform: rotate(45deg);
  transition: transform 160ms ease, opacity 160ms ease;
}

.text-button[data-menu-button][aria-expanded="true"]::after {
  margin-top: 3px;
  opacity: 0.92;
  transform: rotate(225deg);
}

.text-button.danger,
.full-button.danger {
  color: #fff;
  border-color: rgba(0, 0, 0, 0.82);
  background:
    radial-gradient(circle at 24% 14%, rgba(255, 255, 255, 0.28), transparent 34%),
    #101011;
}

.status-chip {
  position: relative;
  min-width: 118px;
  padding: 8px 10px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.42);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.left-panel,
.right-panel {
  min-height: 0;
  padding: 12px;
  border-radius: var(--radius);
  overflow-y: auto;
}

.left-panel {
  grid-column: 1;
  grid-row: 2;
}

.right-panel {
  grid-column: 3;
  grid-row: 2;
}

.panel-section {
  position: relative;
  padding: 0 0 16px;
}

.panel-section + .panel-section {
  padding-top: 14px;
  border-top: 1px solid rgba(0, 0, 0, 0.09);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  margin-bottom: 10px;
  color: #111;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.mini-button {
  width: 28px;
  height: 28px;
  font-size: 14px;
  font-weight: 760;
}

.count-pill {
  padding: 4px 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.45);
  font-size: 10px;
  font-weight: 760;
  text-transform: none;
}

.search-wrap,
label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  outline: none;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.55)),
    rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

input {
  height: 38px;
  padding: 0 11px;
}

textarea {
  min-height: 88px;
  padding: 10px 11px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(0, 0, 0, 0.38);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

select {
  height: 38px;
  padding: 0 10px;
}

input[type="color"] {
  height: 38px;
  padding: 4px;
}

.library-list {
  display: grid;
  gap: 16px;
  margin-top: 10px;
}

.library-group {
  display: grid;
  gap: 8px;
}

.library-group-title {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 820;
  letter-spacing: 0;
  text-transform: uppercase;
}

.library-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 9px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0.28)),
    rgba(255, 255, 255, 0.38);
  text-align: left;
}

.library-item:hover {
  border-color: rgba(0, 0, 0, 0.32);
}

.library-icon,
.node-icon {
  display: grid;
  place-items: center;
}

.library-icon svg,
.node-icon svg {
  width: 30px;
  height: 30px;
  stroke: currentColor;
}

.library-item strong {
  display: block;
  overflow: hidden;
  color: #101010;
  font-size: 13px;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-item span {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.template-button {
  min-height: 38px;
  font-size: 12px;
  font-weight: 720;
}

.input-list {
  display: grid;
  gap: 6px;
}

.modal-input-list {
  max-height: min(520px, calc(100vh - 140px));
  overflow: auto;
  padding: 14px;
}

.input-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 9px;
  border: 1px solid rgba(0, 0, 0, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.32);
}

.input-row .ch {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #111;
  font-size: 11px;
  font-weight: 820;
}

.input-row strong {
  display: block;
  color: #111;
  font-size: 12px;
}

.input-row span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.workspace {
  position: relative;
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, #fbfbfa, #eeeeea);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), var(--shadow);
}

.canvas-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
}

.canvas-frame.panning {
  cursor: grabbing;
}

.canvas-hint {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 3;
  display: flex;
  gap: 8px;
  pointer-events: none;
}

.canvas-hint span {
  padding: 7px 10px;
  border: 1px solid rgba(0, 0, 0, 0.09);
  border-radius: 999px;
  color: rgba(0, 0, 0, 0.52);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(18px);
  font-size: 11px;
  font-weight: 760;
}

.world {
  position: absolute;
  top: 0;
  left: 0;
  width: 5000px;
  height: 3500px;
  transform-origin: 0 0;
  background:
    linear-gradient(rgba(15, 15, 16, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 15, 16, 0.045) 1px, transparent 1px);
  background-size: var(--grid) var(--grid), var(--grid) var(--grid);
}

.edge-layer,
.node-layer,
.terminal-layer {
  position: absolute;
  inset: 0;
}

.edge-layer {
  z-index: 1;
}

.node-layer {
  z-index: 2;
  pointer-events: none;
}

.edge-layer {
  overflow: visible;
  pointer-events: auto;
}

.terminal-layer {
  z-index: 3;
  overflow: visible;
  pointer-events: none;
}

.patch-cable {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 1px rgba(255, 255, 255, 0.85));
  pointer-events: none;
}

.patch-cable-hit {
  fill: none;
  stroke: rgba(0, 0, 0, 0.01);
  stroke-width: 18;
  pointer-events: stroke;
}

.patch-cable-hit:hover + .patch-cable {
  stroke-width: 6;
}

.patch-cable.selected {
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.28));
}

.patch-cable.double-gap {
  filter: none;
  opacity: 1;
}

.cable-direction-arrow {
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(255, 255, 255, 0.86));
}

.cable-direction-halo {
  fill: #fff;
  stroke: #fff;
  stroke-width: 4;
  stroke-linejoin: round;
}

.cable-direction-head {
  stroke: rgba(0, 0, 0, 0.16);
  stroke-width: 0.8;
  stroke-linejoin: round;
}

.patch-cable.preview {
  opacity: 0.72;
  stroke-dasharray: 7 7;
  pointer-events: none;
}

.patch-cable-cursor {
  fill: #fff;
  stroke: #111;
  stroke-width: 2;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.18));
  pointer-events: none;
}

.patch-cable-cursor.locked {
  fill: #111;
  stroke: #fff;
}

.cable-terminal {
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(255, 255, 255, 0.85));
}

.cable-terminal.selected {
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.24));
}

.cable-end-chip {
  pointer-events: none;
  filter: drop-shadow(0 5px 14px rgba(0, 0, 0, 0.12));
}

.terminal-badge-bg {
  fill: rgba(255, 255, 255, 0.92);
  stroke: rgba(0, 0, 0, 0.2);
  stroke-width: 1;
}

.terminal-badge-icon {
  filter: drop-shadow(0 1px 2px rgba(255, 255, 255, 0.9));
}

.terminal-badge-connector {
  fill: #6e6e72;
  font-size: 12.5px;
  font-weight: 760;
  letter-spacing: 0;
}

.terminal-badge-label {
  fill: #111;
  font-size: 10.5px;
  font-weight: 820;
  letter-spacing: 0;
}

.cable-end-chip.selected .terminal-badge-bg {
  stroke: rgba(0, 0, 0, 0.55);
  stroke-width: 1.3;
}

.gear-node {
  position: absolute;
  min-width: 120px;
  min-height: 86px;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  border: 1px solid rgba(0, 0, 0, 0.22);
  border-radius: 8px;
  color: #111;
  background:
    radial-gradient(circle at 28% 12%, rgba(255, 255, 255, 0.95), transparent 28%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(221, 221, 216, 0.72));
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.94);
  user-select: none;
}

.gear-node.selected {
  border-color: #000;
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.82),
    0 22px 58px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.gear-node.multi-selected {
  outline: 1px dashed rgba(0, 0, 0, 0.58);
  outline-offset: 4px;
}

.gear-node.drop-target {
  border-color: #000;
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.62),
    0 22px 58px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.node-header {
  flex: 1;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
}

.node-icon {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.52);
}

.node-title {
  overflow: hidden;
  font-size: 13px;
  font-weight: 820;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-subtitle {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-handle {
  position: absolute;
  z-index: 4;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 2px solid #111;
  border-radius: 50%;
  opacity: 0;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.9), transparent 42%),
    #fff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  transform: translate(-50%, -50%) scale(0.86);
  transition: opacity 140ms ease, transform 140ms ease, background 140ms ease;
  cursor: crosshair;
  touch-action: none;
}

.quick-handle.left {
  left: 0;
  top: 50%;
}

.quick-handle.right {
  left: 100%;
  top: 50%;
}

.quick-handle.top {
  left: 50%;
  top: 0;
}

.quick-handle.bottom {
  left: 50%;
  top: 100%;
}

.gear-node:hover .quick-handle,
.gear-node.selected .quick-handle,
.gear-node.drop-target .quick-handle,
.quick-handle:focus-visible,
.quick-handle.connecting,
.quick-handle.drop-target {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.quick-handle.connecting,
.quick-handle.drop-target {
  color: #fff;
  background: #111;
}

.port {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 74px;
  height: 24px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 999px;
  color: #111;
  background:
    radial-gradient(circle at 32% 22%, rgba(255, 255, 255, 0.82), transparent 42%),
    rgba(255, 255, 255, 0.82);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  font-size: 9px;
  font-weight: 820;
  line-height: 1;
  transform: translate(-50%, -50%);
  cursor: crosshair;
  touch-action: none;
}

.port:hover,
.port.connecting,
.port.drop-target {
  border-color: #000;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08), 0 10px 20px rgba(0, 0, 0, 0.16);
}

.port.drop-target {
  color: #fff;
  background:
    radial-gradient(circle at 32% 22%, rgba(255, 255, 255, 0.24), transparent 42%),
    #111;
}

.port.drop-target .port-shape {
  border-color: #fff;
}

.port.left {
  flex-direction: row-reverse;
}

.port-shape {
  display: grid;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  place-items: center;
  margin-left: 3px;
  border: 1px solid #151515;
  border-radius: 50%;
  color: #111;
  background: #fff;
}

.port.left .port-shape {
  margin-right: 3px;
  margin-left: 0;
}

.port-shape svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
}

.port.usb .port-shape,
.port.hdmi .port-shape,
.port.rca .port-shape {
  border-radius: 4px;
}

.port.midi .port-shape {
  border-radius: 50% 50% 45% 45%;
}

.resize-handle {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 16px;
  height: 16px;
  border-right: 2px solid rgba(0, 0, 0, 0.36);
  border-bottom: 2px solid rgba(0, 0, 0, 0.36);
  cursor: nwse-resize;
}

.floating-card {
  z-index: 6;
  border-radius: 8px;
}

.minimap {
  position: absolute;
  right: 18px;
  bottom: 66px;
  width: 168px;
  height: 116px;
  border: 1px solid rgba(0, 0, 0, 0.14);
}

.mini-node,
.mini-view {
  position: absolute;
  border-radius: 2px;
}

.mini-node {
  background: rgba(0, 0, 0, 0.72);
}

.mini-view {
  border: 1px solid rgba(0, 0, 0, 0.7);
  background: rgba(255, 255, 255, 0.16);
}

.zoom-control {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 5px;
}

.zoom-control span {
  min-width: 46px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 820;
  text-align: center;
}

.port-popover {
  position: absolute;
  z-index: 12;
  display: grid;
  width: 274px;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
}

.popover-head {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.popover-head strong,
.edge-summary strong {
  display: block;
  color: #111;
  font-size: 12px;
  font-weight: 820;
}

.popover-head span,
.edge-summary span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 720;
}

.popover-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.inspector {
  display: grid;
  gap: 12px;
}

.icon-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.icon-choice {
  display: grid;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  color: #111;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.38)),
    rgba(255, 255, 255, 0.46);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 5px 14px rgba(0, 0, 0, 0.08);
}

.icon-choice:hover,
.icon-choice.active {
  border-color: #111;
  background: #fff;
}

.icon-choice.active {
  color: #fff;
  background:
    radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.28), transparent 36%),
    #111;
}

.icon-choice svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
}

.hidden {
  display: none !important;
}

.empty-state {
  display: grid;
  gap: 5px;
  padding: 18px;
  border: 1px dashed rgba(0, 0, 0, 0.16);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.28);
  font-size: 12px;
  text-align: center;
}

.empty-state strong {
  color: #111;
  font-size: 13px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.full-button {
  width: 100%;
  height: 38px;
  font-size: 12px;
  font-weight: 760;
}

.port-list {
  display: grid;
  gap: 8px;
}

.port-editor {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.3);
}

.port-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.port-editor-title {
  color: #111;
  font-size: 11px;
  font-weight: 820;
}

.edge-summary {
  padding: 11px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.34);
}

.signal-pill {
  display: inline-grid;
  place-items: center;
  width: fit-content;
  margin-bottom: 7px;
  padding: 4px 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  color: #111;
  background: rgba(255, 255, 255, 0.55);
  font-size: 10px;
  font-weight: 820;
}

.signal-segmented,
.direction-segmented {
  grid-template-columns: repeat(4, 1fr);
}

.edge-endpoints {
  display: grid;
  gap: 8px;
}

.edge-endpoint {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.3);
}

.edge-endpoint strong {
  color: #111;
  font-size: 11px;
  font-weight: 820;
}

.endpoint-gender {
  grid-template-columns: repeat(3, 1fr);
}

.edge-custom-kind {
  margin-top: -2px;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.color-swatch {
  height: 30px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0)),
    var(--swatch);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 5px 12px rgba(0, 0, 0, 0.08);
}

.color-swatch.active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111, 0 8px 16px rgba(0, 0, 0, 0.14);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.segmented button {
  min-height: 28px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.46);
  color: var(--muted);
  font-size: 10px;
  font-weight: 780;
}

.segmented button.active {
  color: #fff;
  border-color: #101010;
  background: #101010;
}

.storage-meter {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.26);
}

.storage-meter > div:first-child {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}

.storage-meter strong {
  color: #111;
}

.meter-track {
  overflow: hidden;
  height: 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
}

.meter-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #111;
  transition: width 200ms ease;
}

.modal {
  width: min(520px, calc(100vw - 28px));
  max-height: min(620px, calc(100vh - 28px));
  padding: 0;
  border-radius: 8px;
  color: var(--ink);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(6px);
}

.modal-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-head h2 {
  font-size: 15px;
}

.document-modal {
  width: min(460px, calc(100vw - 28px));
}

.input-list-modal {
  width: min(520px, calc(100vw - 28px));
}

.document-form {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 14px;
}

.start-modal {
  width: min(560px, calc(100vw - 28px));
}

.start-flow {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.start-option {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 72px;
  padding: 14px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.38)),
    rgba(255, 255, 255, 0.46);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 8px 20px rgba(0, 0, 0, 0.08);
  text-align: left;
}

.start-option:hover {
  border-color: rgba(0, 0, 0, 0.34);
  background: rgba(255, 255, 255, 0.78);
}

.start-option strong {
  color: #111;
  font-size: 14px;
  font-weight: 820;
}

.start-option span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
}

.history-list {
  position: relative;
  display: grid;
  gap: 8px;
  max-height: 500px;
  padding: 14px;
  overflow: auto;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(0, 0, 0, 0.11);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
}

.history-item strong {
  display: block;
  font-size: 12px;
}

.history-item span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.toast-stack {
  position: fixed;
  z-index: 30;
  right: 22px;
  top: 88px;
  display: grid;
  gap: 8px;
  width: min(320px, calc(100vw - 44px));
  pointer-events: none;
}

.toast {
  padding: 11px 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  color: #111;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.58)),
    rgba(255, 255, 255, 0.64);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(22px);
  font-size: 12px;
  font-weight: 740;
}

.drop-active .workspace {
  outline: 2px solid rgba(0, 0, 0, 0.75);
  outline-offset: -8px;
}

.print-sheet {
  display: none;
}

@media (max-width: 1100px) {
  :root {
    --left: 236px;
    --right: 280px;
  }

  .brand p,
  .status-chip {
    display: none;
  }

  .text-button {
    padding: 0 9px;
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 640px auto;
    height: auto;
    min-height: 100vh;
  }

  .topbar,
  .left-panel,
  .right-panel,
  .workspace {
    grid-column: 1;
  }

  .topbar {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .toolbar {
    order: 3;
    justify-content: flex-start;
    width: 100%;
  }

  .left-panel {
    grid-row: 2;
  }

  .workspace {
    grid-row: 3;
  }

  .right-panel {
    grid-row: 4;
  }
}

@media print {
  body {
    overflow: visible;
    background: #fff;
  }

  .app-shell,
  .toast-stack,
  .modal {
    display: none !important;
  }

  .print-sheet {
    display: block;
    color: #000;
    font-family: Arial, sans-serif;
  }

  .print-page {
    min-height: 100vh;
    padding: 20mm;
    page-break-after: always;
  }

  .print-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin-bottom: 12mm;
    border-bottom: 1px solid #111;
    padding-bottom: 6mm;
  }

  .print-header h2 {
    font-size: 24px;
  }

  .print-header p {
    margin-top: 4px;
    font-size: 10px;
  }

  .print-diagram svg {
    width: 100%;
    height: auto;
    border: 1px solid #111;
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
  }

  .print-table th,
  .print-table td {
    border: 1px solid #111;
    padding: 7px;
    text-align: left;
    vertical-align: top;
  }
}
