/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; font-size: 13px; color: #ccc; background: #1e1e1e; }

/* ── App Grid ── */
#app {
  display: grid;
  position: fixed;
  inset: 0;
  height: 100dvh;
  overflow: hidden;
  grid-template-columns: 180px 1fr 260px;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "toolbar    toolbar    toolbar"
    "toolbox    canvas     properties"
    "lua        lua        lua";
}

/* ── Toolbar ── */
#toolbar {
  grid-area: toolbar;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px;
  background: #2d2d2d;
  border-bottom: 1px solid #444;
}
.toolbar-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
#toolbar button {
  padding: 3px 7px;
  background: #3c3c3c;
  color: #ddd;
  border: 1px solid #555;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  white-space: nowrap;
  line-height: 1.4;
}
#toolbar button:hover:not(:disabled) { background: #505050; }
#toolbar button:active:not(:disabled) { background: #606060; }
#toolbar button:disabled { opacity: 0.35; cursor: default; }
#toolbar button.warning { border-color: #c44; color: #f99; }
#toolbar button.warning:hover:not(:disabled) { border-color: #e55; }
#toolbar label { font-size: 11px; display: flex; align-items: center; gap: 2px; white-space: nowrap; }
#toolbar input[type="number"] {
  background: #2a2a2a; color: #ddd; border: 1px solid #555; border-radius: 3px;
  padding: 2px 4px; font-size: 11px;
}
#toolbar input[type="checkbox"] { accent-color: #4a9eff; }
.toolbar-group { display: flex; align-items: center; gap: 3px; }
.toolbar-separator { width: 1px; height: 22px; background: #555; margin: 0 3px; flex-shrink: 0; }

/* ── Toolbox ── */
#toolbox {
  grid-area: toolbox;
  background: #1e1e1e;
  padding: 8px;
  overflow-y: auto;
  border-right: 1px solid #3a3a3a;
}
#toolbox h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin: 12px 0 6px 0;
}
#toolbox h3:first-child { margin-top: 4px; }
.toolbox-item {
  padding: 6px 10px;
  margin: 2px 0;
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  cursor: grab;
  user-select: none;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.toolbox-item:hover { background: #383838; border-color: #555; }
.toolbox-item:active { cursor: grabbing; }
.toolbox-icon { font-size: 14px; width: 18px; text-align: center; color: #aaa; }

/* ── Outline ── */
#outline { margin-top: 12px; }
#outline h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: #888; margin: 0 0 6px 0; }
.outline-group-header { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: #666; padding: 4px 6px; margin-top: 6px; }
.outline-item {
  padding: 3px 8px;
  margin: 1px 0;
  font-size: 11px;
  cursor: pointer;
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #aaa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.outline-item:hover { background: #2e2e2e; }
.outline-item.selected { background: #264f78; color: #fff; }
.outline-icon { width: 14px; text-align: center; font-size: 11px; flex-shrink: 0; color: #888; }
.outline-item.selected .outline-icon { color: #ccc; }
.outline-name { overflow: hidden; text-overflow: ellipsis; }

/* ── Canvas Container ── */
#canvas-container {
  grid-area: canvas;
  background: #2a2a2a;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}
#canvas-viewport {
  padding: 40px;
  display: inline-block;
  min-width: 100%;
  min-height: 100%;
  flex: 1;
  overflow: auto;
}

/* ── Page Tabs ── */
#page-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  background: #252525;
  border-bottom: 1px solid #444;
  padding: 0 4px;
  min-height: 28px;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
}
.page-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: #2a2a2a;
  color: #888;
  border: 1px solid #444;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  font-size: 11px;
  white-space: nowrap;
  user-select: none;
  margin-right: -1px;
  position: relative;
}
.page-tab:hover { background: #333; color: #ccc; }
.page-tab.active {
  background: #2a2a2a;
  color: #ddd;
  border-bottom: 1px solid #2a2a2a;
  z-index: 1;
}
.page-tab-close {
  background: none;
  border: none;
  color: #666;
  font-size: 12px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.page-tab-close:hover { color: #ff5555; }
.page-tab-add {
  padding: 3px 10px;
  background: transparent;
  color: #888;
  border: 1px dashed #555;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  font-size: 13px;
  margin-left: 4px;
}
.page-tab-add:hover { background: #333; color: #ddd; border-color: #4a9eff; }
.page-tab-rename-input {
  background: #1e1e1e;
  color: #ddd;
  border: 1px solid #4a9eff;
  border-radius: 2px;
  padding: 1px 4px;
  font-size: 11px;
  width: 80px;
  outline: none;
}
#canvas {
  position: relative;
  isolation: isolate;
  background: #252525;
  user-select: none;
  -webkit-user-select: none;
}

/* ── Canvas Overlays ── */
#target-size-rect {
  position: absolute;
  top: 0;
  left: 0;
  border: 1px solid rgba(100, 150, 255, 0.25);
  pointer-events: none;
  z-index: -1;
}
#bounding-box-rect {
  position: absolute;
  top: 0;
  left: 0;
  border: 1px dashed rgba(255, 180, 50, 0.5);
  pointer-events: none;
  z-index: -1;
}
#bounding-box-rect.empty {
  display: none;
}
.bbox-label {
  position: absolute;
  bottom: -16px;
  right: 0;
  font-size: 10px;
  color: rgba(255, 180, 50, 0.7);
  pointer-events: none;
  white-space: nowrap;
}
#canvas.show-grid {
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.04) 1px, transparent 1px);
}

/* ── Light canvas theme ── */
#canvas.theme-light { background: #e0e4e8; }
#canvas.theme-light.show-grid {
  background-image:
    linear-gradient(to right, rgba(0,0,0,0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,0.06) 1px, transparent 1px);
}
#canvas.theme-light ~ #target-size-rect,
#canvas.theme-light #target-size-rect { border-color: rgba(60, 120, 200, 0.5); }
#canvas.theme-light .bbox-rect { border-color: rgba(200, 140, 30, 0.5); }
#canvas.theme-light .bbox-label { color: rgba(160, 100, 10, 0.7); }
#canvas-container.theme-light { background: #c8ccd0; }

/* ── Canvas Objects ── */
.canvas-object {
  position: absolute;
  cursor: move;
  user-select: none;
  overflow: visible;
  font-size: 10px;
  color: #ddd;
  transition: outline-color 0.1s;
}
.control-body {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.canvas-object:hover:not(.selected) {
  outline: 1px solid rgba(74, 158, 255, 0.4);
  outline-offset: -1px;
}
.canvas-object.selected {
  outline: 2px solid #4a9eff;
  outline-offset: -1px;
}
.canvas-object.array-sibling {
  outline: 1px dashed #e06c00;
  outline-offset: -1px;
}
.canvas-object .object-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  pointer-events: none;
}

.array-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 14px;
  height: 14px;
  background: #e06c00;
  color: #fff;
  font-size: 9px;
  font-weight: bold;
  line-height: 14px;
  text-align: center;
  border-radius: 7px;
  padding: 0 3px;
  pointer-events: none;
  z-index: 5;
}

/* ── Button ── */
.canvas-object[data-style="Button"] > .control-body {
  background: #7c7c7c;
  border: 1px solid #696969;
  border-radius: 2px;
}
.canvas-object[data-style="Button"] .gloss-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.28), rgba(255,255,255,0.04));
  pointer-events: none;
  border-radius: inherit;
}

/* ── Knob: semicircle pie + value textbox ── */
.canvas-object[data-style="Knob"] > .control-body {
  background: transparent;
  border: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}
.canvas-object[data-style="Knob"] .knob-svg {
  width: 100%;
  flex-shrink: 0;
  pointer-events: none;
}
.canvas-object[data-style="Knob"] .object-label {
  flex: 1;
  width: 100%;
  min-height: 0;
  background: #f0f0f0;
  color: #333;
  border: 1px solid #aaa;
  border-radius: 2px;
  font-size: 9px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
}
.knob-bg {
  fill: #e8e8e8;
}
.knob-arc-border {
  fill: none;
  stroke: #999;
  stroke-width: 1.5;
}
.knob-tick {
  stroke: #999;
  stroke-width: 1.5;
}

/* ── Fader: track + thumb (positioning set inline by JS) ── */
.canvas-object[data-style="Fader"] > .control-body {
  background: transparent;
  border: none;
}
.canvas-object[data-style="Fader"] .fader-track {
  background: #b8b8b8;
  pointer-events: none;
}
.canvas-object[data-style="Fader"] .fader-thumb {
  background: #2a7f9e;
  pointer-events: none;
}
.canvas-object[data-style="Fader"] .object-label {
  background: #f0f0f0;
  color: #333;
  border: 1px solid #aaa;
  border-radius: 2px;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
}

/* ── LED: simple filled circle ── */
.canvas-object[data-style="Led"] > .control-body {
  background: #063;
  border: 1px solid #696969;
  border-radius: 50%;
}
.canvas-object[data-style="Led"] .object-label {
  display: none;
}

/* ── Meter: vertical bar with fill + value textbox ── */
.canvas-object[data-style="Meter"] > .control-body {
  background: transparent;
  border: none;
  flex-direction: column;
  padding: 0;
  gap: 1px;
}
.canvas-object[data-style="Meter"] .meter-bar {
  flex: 1;
  width: 100%;
  min-height: 0;
  background: #ccc;
  border: 1px solid #696969;
  border-radius: 3px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}
.canvas-object[data-style="Meter"] .meter-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 55%;
  background: #00e664;
  pointer-events: none;
}
.canvas-object[data-style="Meter"] .object-label {
  background: #f0f0f0;
  color: #333;
  border: 1px solid #aaa;
  border-radius: 2px;
  font-size: 9px;
  text-align: center;
  line-height: 16px;
  height: 16px;
  flex-shrink: 0;
  width: 100%;
}

/* ── Text / ComboBox / ListBox ── */
.canvas-object[data-style="Text"] > .control-body,
.canvas-object[data-style="ListBox"] > .control-body,
.canvas-object[data-style="ComboBox"] > .control-body {
  background: #2a2a2a;
  border: 1px solid #666;
  border-radius: 2px;
}
.canvas-object[data-graphic-type="Label"] > .control-body {
  background: transparent;
  border: 1px dashed rgba(255,255,255,0.15);
}
.canvas-object[data-graphic-type="GroupBox"] > .control-body {
  background: transparent;
  border: none;
  padding: 0;
}
.groupbox-svg {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}
.groupbox-text {
  position: absolute;
  white-space: nowrap;
  line-height: 1;
  pointer-events: none;
}
.header-wrapper {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 2px;
}
.header-line {
  flex: 1;
  min-width: 4px;
  border-bottom: 1px solid #333;
}
.header-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: bold;
  padding: 0 2px;
}
.canvas-object[data-graphic-type="Image"] > .control-body,
.canvas-object[data-graphic-type="Svg"] > .control-body {
  background: rgba(40, 40, 40, 0.6);
  border: 1px dashed rgba(255, 255, 255, 0.2);
}
.canvas-object[data-graphic-type="Image"] .object-label,
.canvas-object[data-graphic-type="Svg"] .object-label {
  color: #666;
  font-size: 11px;
  font-style: italic;
}
.canvas-object .object-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* ── Resize Handles ── */
.resize-handle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #4a9eff;
  border: 1px solid #fff;
  z-index: 10;
  display: none;
}
.canvas-object.selected .resize-handle { display: block; }
.resize-handle.nw { top: -4px; left: -4px; cursor: nw-resize; }
.resize-handle.n  { top: -4px; left: calc(50% - 4px); cursor: n-resize; }
.resize-handle.ne { top: -4px; right: -4px; cursor: ne-resize; }
.resize-handle.e  { top: calc(50% - 4px); right: -4px; cursor: e-resize; }
.resize-handle.se { bottom: -4px; right: -4px; cursor: se-resize; }
.resize-handle.s  { bottom: -4px; left: calc(50% - 4px); cursor: s-resize; }
.resize-handle.sw { bottom: -4px; left: -4px; cursor: sw-resize; }
.resize-handle.w  { top: calc(50% - 4px); left: -4px; cursor: w-resize; }

/* ── Rubber Band Selection ── */
#selection-rect {
  position: absolute;
  border: 1px dashed #4a9eff;
  background: rgba(74, 158, 255, 0.08);
  pointer-events: none;
  z-index: 1000;
}

/* ── Properties Panel ── */
#properties-panel {
  grid-area: properties;
  background: #1e1e1e;
  padding: 0;
  overflow-y: auto;
  border-left: 1px solid #3a3a3a;
}
#properties-panel h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  padding: 8px 10px 6px;
  border-bottom: 1px solid #333;
  position: sticky;
  top: 0;
  background: #1e1e1e;
  z-index: 1;
}
#properties-content {
  padding: 6px 10px;
}
.placeholder-text { color: #666; font-style: italic; font-size: 12px; padding: 20px 0; text-align: center; }

/* Properties form */
.props-section {
  margin-bottom: 10px;
}
.props-section-header {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #4a9eff;
  padding: 6px 0 4px;
  border-bottom: 1px solid #333;
  margin-bottom: 4px;
}
.props-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
  min-height: 24px;
}
.props-row label {
  font-size: 11px;
  color: #aaa;
  flex-shrink: 0;
  width: 90px;
}
.props-row input[type="text"],
.props-row input[type="number"],
.props-row select {
  flex: 1;
  min-width: 0;
  max-width: 140px;
  padding: 2px 4px;
  background: #2a2a2a;
  border: 1px solid #444;
  color: #ddd;
  border-radius: 3px;
  font-size: 11px;
}
.props-row input[type="color"] {
  width: 32px;
  height: 22px;
  border: 1px solid #444;
  border-radius: 3px;
  background: none;
  padding: 0;
  cursor: pointer;
}
.props-row input[type="checkbox"] { accent-color: #4a9eff; }
.props-row .color-alpha {
  width: 48px;
  flex: 0 0 48px;
  max-width: 48px;
  margin-left: 4px;
}
.props-row-quad {
  display: grid;
  grid-template-columns: 90px 1fr 1fr;
  gap: 4px;
  align-items: center;
  padding: 2px 0;
}
.props-row-quad label { grid-column: 1; font-size: 11px; color: #aaa; }
.props-row-quad input {
  padding: 2px 4px;
  background: #2a2a2a;
  border: 1px solid #444;
  color: #ddd;
  border-radius: 3px;
  font-size: 11px;
  width: 100%;
}

/* ── Lua Panel ── */
#lua-panel {
  grid-area: lua;
  background: #1e1e1e;
  border-top: 1px solid #444;
  display: flex;
  flex-direction: column;
  height: 20vh;
  transition: height 0.2s ease;
}
#lua-panel.collapsed {
  height: 30px;
  overflow: hidden;
}
#lua-panel.maximized {
  position: fixed;
  inset: 0;
  height: 100%;
  z-index: 9000;
  border-top: none;
  border-radius: 0;
}
#lua-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: #2d2d2d;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
}
#lua-panel-header h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  flex: 1;
}
#lua-panel-header button {
  padding: 2px 8px;
  background: #3c3c3c;
  color: #ddd;
  border: 1px solid #555;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
}
#lua-panel-header button:hover { background: #505050; }
#lua-panel-header .lua-icon-btn {
  padding: 2px 4px;
  background: transparent;
  border: none;
  color: #666;
  font-size: 14px;
  line-height: 1;
}
#lua-panel-header .lua-icon-btn:hover { color: #aaa; background: transparent; }
#lua-panel-header .lua-warning {
  color: #e8a030;
  font-size: 13px;
  cursor: default;
}
#lua-output-wrap {
  flex: 1;
  background: #0d0d0d;
  margin: 0;
  padding: 8px 10px;
  overflow: auto;
  min-height: 0;
}
#lua-output {
  color: #d4d4d4;
  font-family: 'Consolas', 'SF Mono', 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre;
}
/* Lua syntax token colors */
.lua-keyword  { color: #569cd6; }
.lua-builtin  { color: #4ec9b0; }
.lua-string   { color: #ce9178; }
.lua-number   { color: #b5cea8; }
.lua-comment  { color: #6a9955; font-style: italic; }
.lua-ident    { color: #dcdcaa; }
.lua-line.hl  { background: rgba(255, 200, 50, 0.12); display: inline; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.modal-overlay[hidden] { display: none; }
.modal-dialog {
  background: #2d2d2d;
  border: 1px solid #555;
  border-radius: 6px;
  min-width: 380px;
  max-width: 480px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #444;
}
.modal-header h3 {
  font-size: 13px;
  color: #ddd;
  font-weight: 600;
}
.modal-close {
  background: none;
  border: none;
  color: #888;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.modal-close:hover { color: #ddd; }
.modal-body {
  padding: 12px 14px;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid #444;
}
.modal-footer button {
  padding: 5px 16px;
  background: #3c3c3c;
  color: #ddd;
  border: 1px solid #555;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
}
.modal-footer button:hover { background: #505050; }
.modal-footer .btn-primary {
  background: #2a6fdb;
  border-color: #3a7fe8;
}
.modal-footer .btn-primary:hover { background: #3580e8; }

/* About modal */
.about-body h4 { font-size: 14px; color: #ddd; margin-bottom: 8px; }
.about-body p { font-size: 12px; color: #aaa; line-height: 1.6; margin-bottom: 10px; }
.about-body code { background: #1a1a1a; padding: 1px 4px; border-radius: 2px; font-size: 11px; color: #ce9178; }
.about-version { color: #ccc !important; font-size: 11px !important; margin-top: -4px !important; margin-bottom: 12px !important; }
.about-privacy { color: #6a9955 !important; }
.about-disclaimer { color: #888 !important; font-style: italic; font-size: 11px !important; }
.about-copyright { color: #999 !important; font-size: 11px !important; text-align: center; margin-top: 8px !important; margin-bottom: 2px !important; }
.about-repo { text-align: center; font-size: 11px !important; margin-bottom: 4px !important; }
.about-repo a { color: #569cd6; }
.about-license { color: #888 !important; font-size: 10px !important; text-align: center; line-height: 1.5 !important; }
.about-license a { color: #6a9955; }

/* Settings form */
.settings-section {
  margin-bottom: 12px;
}
.settings-section:last-child { margin-bottom: 0; }
.settings-section h4 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #4a9eff;
  padding-bottom: 4px;
  border-bottom: 1px solid #333;
  margin-bottom: 6px;
}
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}
.settings-row label {
  font-size: 12px;
  color: #aaa;
}
.settings-row input[type="number"],
.settings-row select {
  width: 100px;
  padding: 3px 6px;
  background: #1e1e1e;
  border: 1px solid #444;
  color: #ddd;
  border-radius: 3px;
  font-size: 12px;
}
.settings-row input[type="checkbox"] {
  accent-color: #4a9eff;
}
.settings-row input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 3px 6px;
  background: #1e1e1e;
  border: 1px solid #444;
  color: #ddd;
  border-radius: 3px;
  font-size: 12px;
}

.required-tag {
  font-size: 9px;
  color: #e06c00;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ── PluginInfo Id field group ── */
.pi-id-group {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.pi-id-group input[type="text"] {
  flex: 1;
  min-width: 0;
}
.pi-id-group button {
  padding: 3px 8px;
  background: #3c3c3c;
  color: #ddd;
  border: 1px solid #555;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}
.pi-id-group button:hover { background: #505050; }

/* ── ComboBox Items Editor ── */
.combobox-items-list {
  margin: 4px 0;
}
.combobox-item-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 2px 0;
}
.combobox-item-row input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 2px 4px;
  background: #2a2a2a;
  border: 1px solid #444;
  color: #ddd;
  border-radius: 3px;
  font-size: 11px;
}
.combobox-item-row button {
  padding: 1px 5px;
  background: #3c3c3c;
  color: #aaa;
  border: 1px solid #555;
  border-radius: 3px;
  cursor: pointer;
  font-size: 9px;
  line-height: 1.4;
  flex-shrink: 0;
}
.combobox-item-row button:hover { background: #505050; color: #ddd; }
.combobox-item-row button:disabled { opacity: 0.3; cursor: default; }
.combobox-add-btn {
  width: 100%;
  padding: 4px;
  margin: 4px 0;
  background: #333;
  color: #aaa;
  border: 1px dashed #555;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
}
.combobox-add-btn:hover { background: #3c3c3c; color: #ddd; border-color: #4a9eff; }

/* ── Pins Editor ── */
.pins-hint {
  font-size: 11px;
  color: #888;
  margin-bottom: 8px;
}
.pin-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 3px 0;
}
.pin-row input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 3px 6px;
  background: #1e1e1e;
  border: 1px solid #444;
  color: #ddd;
  border-radius: 3px;
  font-size: 12px;
}
.pin-row select {
  padding: 3px 4px;
  background: #1e1e1e;
  border: 1px solid #444;
  color: #ddd;
  border-radius: 3px;
  font-size: 12px;
}
.pin-row button {
  padding: 2px 6px;
  background: #3c3c3c;
  color: #aaa;
  border: 1px solid #555;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  flex-shrink: 0;
}
.pin-row button:hover { background: #505050; color: #ddd; }
.pins-empty {
  color: #666;
  font-style: italic;
  font-size: 11px;
  text-align: center;
  padding: 8px 0;
}

/* ── Design-Time Properties Editor ── */
.dprop-card {
  background: #252525;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  padding: 8px;
  margin: 6px 0;
  position: relative;
}
.dprop-card-header {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}
.dprop-card-header input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 3px 6px;
  background: #1e1e1e;
  border: 1px solid #444;
  color: #ddd;
  border-radius: 3px;
  font-size: 12px;
}
.dprop-card-header select {
  padding: 3px 4px;
  background: #1e1e1e;
  border: 1px solid #444;
  color: #ddd;
  border-radius: 3px;
  font-size: 12px;
  width: 90px;
}
.dprop-card-header button {
  padding: 2px 6px;
  background: #3c3c3c;
  color: #aaa;
  border: 1px solid #555;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  flex-shrink: 0;
}
.dprop-card-header button:hover { background: #505050; color: #ddd; }
.dprop-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
}
.dprop-field {
  display: flex;
  align-items: center;
  gap: 3px;
}
.dprop-field label {
  font-size: 10px;
  color: #888;
  white-space: nowrap;
}
.dprop-field input[type="text"],
.dprop-field input[type="number"] {
  padding: 2px 4px;
  background: #1e1e1e;
  border: 1px solid #444;
  color: #ddd;
  border-radius: 3px;
  font-size: 11px;
  width: 80px;
}
.dprop-field select {
  padding: 2px 4px;
  background: #1e1e1e;
  border: 1px solid #444;
  color: #ddd;
  border-radius: 3px;
  font-size: 11px;
}
.dprop-choices-input {
  width: 100% !important;
  margin-top: 4px;
}
.dprop-optional {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}
.dprop-optional input[type="text"] {
  padding: 2px 4px;
  background: #1e1e1e;
  border: 1px solid #444;
  color: #ddd;
  border-radius: 3px;
  font-size: 11px;
  flex: 1;
  min-width: 80px;
}
