:root {
  color-scheme: light;
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
  background: #e9eef2;
  color: #172026;
  --editor-safe-left: 264px;
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
}

#app {
  position: relative;
  background: #dde7ec;
}

#viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hud,
#status {
  position: absolute;
  z-index: 2;
  left: 16px;
  border: 1px solid rgba(23, 32, 38, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 30px rgba(23, 32, 38, 0.12);
  backdrop-filter: blur(10px);
}

.hud {
  top: 16px;
  left: var(--editor-safe-left);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
}

.hud strong {
  font-size: 14px;
  line-height: 1.2;
}

.hud span,
#status {
  font-size: 12px;
  line-height: 1.35;
  color: #52616b;
}

#status {
  bottom: 16px;
  left: var(--editor-safe-left);
  max-width: min(420px, calc(100vw - var(--editor-safe-left) - 32px));
  padding: 8px 10px;
}

.object-hover-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 8;
  max-width: 220px;
  padding: 5px 8px;
  border: 1px solid rgba(23, 32, 38, 0.16);
  border-radius: 6px;
  background: rgba(23, 32, 38, 0.86);
  color: #ffffff;
  font-size: 12px;
  line-height: 1.25;
  white-space: pre-line;
  pointer-events: none;
  box-shadow: 0 8px 20px rgba(23, 32, 38, 0.18);
}

.editor-shell {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.editor-sidebar,
.editor-properties {
  position: absolute;
  top: 16px;
  bottom: 16px;
  width: 152px;
  overflow: auto;
  pointer-events: auto;
  border: 1px solid rgba(23, 32, 38, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 34px rgba(23, 32, 38, 0.14);
  backdrop-filter: blur(10px);
}

.editor-sidebar {
  left: 16px;
  width: 52px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  transition: width 0.22s ease, padding 0.22s ease, box-shadow 0.22s ease;
  overflow-x: hidden;
}

.editor-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #31424f;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.editor-menu-item i {
  width: 16px;
  flex: 0 0 16px;
  text-align: center;
  font-size: 14px;
}

.editor-menu-item span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editor-menu-item:hover {
  background: #e8f1f8;
  border-color: rgba(37, 99, 235, 0.32);
  color: #1d4ed8;
}

.editor-menu-item.is-active {
  background: #dbeafe;
  border-color: rgba(37, 99, 235, 0.44);
  color: #1d4ed8;
}

.editor-menu-item.is-disabled {
  cursor: not-allowed;
  color: #94a3b8;
  opacity: 0.72;
}

.editor-menu-item.is-disabled:hover {
  background: transparent;
  border-color: transparent;
  color: #94a3b8;
}

.editor-menu-submenu-toggle .editor-menu-chevron {
  flex: 0 0 12px;
  font-size: 10px;
  margin-left: auto;
  transition: transform 0.15s ease;
}

.editor-menu-submenu-toggle.is-open .editor-menu-chevron {
  transform: rotate(180deg);
}

.editor-menu-submenu {
  display: none;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 4px 0;
  padding: 0 0 0 16px;
  border-left: 1px solid rgba(23, 32, 38, 0.12);
}

.editor-menu-submenu.is-open {
  display: flex;
}

.editor-menu-submenu .editor-menu-item {
  font-size: 12px;
  min-height: 28px;
  padding: 4px 8px;
}

.editor-sidebar.is-collapsed .editor-menu-item span,
.editor-sidebar.is-collapsed .editor-menu-submenu-toggle .editor-menu-chevron {
  display: none;
}

.editor-sidebar.is-collapsed .editor-menu-submenu {
  display: none;
}

.editor-sidebar.is-collapsed .editor-info-panel {
  display: none;
}

.editor-sidebar.is-collapsed .editor-menu-item {
  justify-content: center;
  padding: 6px 0;
}

.editor-sidebar:not(.is-collapsed) {
  width: 230px;
  padding: 6px 4px;
}

.editor-info-panel {
  display: grid;
  gap: 7px;
  margin-top: 8px;
  padding: 8px;
  border-top: 1px solid rgba(23, 32, 38, 0.12);
  background: rgba(248, 250, 252, 0.76);
}

.editor-info-title {
  color: #31424f;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.editor-info-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
  color: #52616b;
  font-size: 11px;
  line-height: 1.25;
}

.editor-info-summary strong,
.editor-info-row strong {
  color: #172026;
  font-weight: 700;
}

.editor-info-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.editor-info-tabs button {
  flex: 0 0 auto;
  min-height: 24px;
  border: 1px solid rgba(23, 32, 38, 0.14);
  border-radius: 5px;
  padding: 3px 6px;
  background: #fff;
  color: #52616b;
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

.editor-info-tabs button.is-active {
  border-color: rgba(37, 99, 235, 0.44);
  background: #dbeafe;
  color: #1d4ed8;
}

.editor-info-content {
  display: grid;
  gap: 4px;
}

.editor-info-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: baseline;
  color: #52616b;
  font-size: 11px;
  line-height: 1.3;
}

.editor-info-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-properties {
  right: 16px;
  width: 260px;
  padding: 12px 12px 12px 0;
  display: flex;
  align-items: stretch;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.editor-properties.is-collapsed {
  transform: translateX(calc(100% - 14px));
  opacity: 0.96;
  padding: 12px 0 12px 6px;
  background: rgba(255, 255, 255, 0.82);
}

.editor-properties-body {
  flex: 1;
  min-width: 0;
  padding-left: 12px;
  overflow: auto;
}

.editor-properties-handle {
  flex: 0 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #52616b;
}

.editor-properties-handle:hover {
  color: #1d4ed8;
}

.editor-properties-grip {
  display: block;
  width: 4px;
  height: 32px;
  border-radius: 2px;
  background: currentColor;
  box-shadow: 0 -8px 0 0 currentColor, 0 8px 0 0 currentColor;
}

.editor-properties.is-collapsed .editor-properties-grip {
  transform: rotate(180deg);
}

.editor-context-menu {
  position: fixed;
  z-index: 50;
  min-width: 200px;
  max-width: 280px;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  border: 1px solid rgba(23, 32, 38, 0.18);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 38px rgba(23, 32, 38, 0.22);
  font-size: 12px;
  color: #172026;
}

.editor-context-menu-item {
  padding: 8px 14px;
  cursor: pointer;
  user-select: none;
}

.editor-context-menu-item:hover {
  background: #e8f1f8;
  color: #1d4ed8;
}

.editor-context-menu-item.is-disabled {
  color: #94a3b0;
  cursor: not-allowed;
}

.editor-context-menu-separator {
  list-style: none;
  height: 1px;
  margin: 4px 0;
  background: rgba(23, 32, 38, 0.12);
}

.editor-form-section-heading {
  margin: 6px 0 4px;
  padding: 0 0 4px;
  border-bottom: 1px solid rgba(23, 32, 38, 0.12);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #52616b;
}

.editor-form-advanced {
  margin: 8px 0 4px;
  border: 1px solid rgba(23, 32, 38, 0.12);
  border-radius: 6px;
  background: #f8fafc;
}

.editor-form-advanced > summary {
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #31424f;
  cursor: pointer;
  list-style: none;
}

.editor-form-advanced > summary::before {
  content: '\25B8';
  display: inline-block;
  width: 12px;
  margin-right: 4px;
  color: #52616b;
  transition: transform 0.15s ease;
}

.editor-form-advanced[open] > summary::before {
  transform: rotate(90deg);
}

.editor-form-advanced-body {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.editor-create-button.is-placing {
  border-color: rgba(37, 99, 235, 0.6);
  background: #dbeafe;
  color: #1d4ed8;
}

.editor-console {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translate(calc(-50% + var(--console-drag-x, 0px)), var(--console-drag-y, 0px));
  z-index: 4;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 18px 12px;
  border: 1px solid rgba(23, 32, 38, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 30px rgba(23, 32, 38, 0.18);
  backdrop-filter: blur(12px);
  cursor: grab;
  user-select: none;
  min-width: 280px;
}

.editor-console:active,
.editor-console.is-dragging {
  cursor: grabbing;
}

.editor-console-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: center;
}

.editor-console-speed-row,
.editor-console-start-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: center;
}

.editor-console-button {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(23, 32, 38, 0.18);
  border-radius: 50%;
  background: #f8fafc;
  color: #172026;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.editor-console-button:hover {
  background: #e8f1f8;
  border-color: rgba(37, 99, 235, 0.44);
  color: #1d4ed8;
}

.editor-console-button[data-action="sim-start"]:hover {
  background: #dcfce7;
  border-color: rgba(22, 101, 52, 0.44);
  color: #166534;
}

.editor-console-button[data-action="sim-stop"]:hover {
  background: #fee2e2;
  border-color: rgba(180, 35, 24, 0.44);
  color: #a3261d;
}

.editor-console-icon {
  font-size: 16px;
  line-height: 1;
}

.editor-console-speed,
.editor-console-start {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #52616b;
  cursor: default;
}

.editor-console-label {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.editor-console-speed input[type="range"] {
  width: 96px;
  accent-color: #2563eb;
}

.editor-console-start input {
  min-height: 28px;
  max-width: 126px;
  border: 1px solid rgba(23, 32, 38, 0.16);
  border-radius: 6px;
  padding: 4px 6px;
  background: #ffffff;
  color: #172026;
  font: inherit;
  font-size: 11px;
}

.editor-console-speed-value {
  min-width: 38px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #172026;
  font-weight: 600;
}

.editor-console-status {
  font-size: 11px;
  color: #52616b;
  font-variant-numeric: tabular-nums;
  padding: 4px 10px;
  border-radius: 6px;
  background: #f1f5f9;
  white-space: nowrap;
}

.editor-console-status.is-running {
  background: #dcfce7;
  color: #166534;
}

.editor-minimap {
  position: fixed;
  left: 68px;
  bottom: 16px;
  z-index: 20;
  padding: 6px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(23, 32, 38, 0.14);
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.editor-minimap[hidden] {
  display: none;
}

.editor-minimap-canvas {
  display: block;
  border-radius: 4px;
  cursor: crosshair;
}

.editor-minimap-label {
  font-size: 10px;
  font-weight: 600;
  color: #52616b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  cursor: move;
  user-select: none;
}

.editor-setting-toggle {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.editor-setting-toggle input {
  width: auto;
}

.editor-title {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #172026;
}

.editor-menu-button,
.editor-create-button,
.editor-form-actions button,
.editor-sim-grid button {
  width: 100%;
  min-height: 32px;
  border: 1px solid rgba(23, 32, 38, 0.16);
  border-radius: 6px;
  background: #f8fafc;
  color: #172026;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.editor-menu-button:hover,
.editor-create-button:hover,
.editor-form-actions button:hover,
.editor-sim-grid button:hover {
  background: #e8f1f8;
}

.editor-menu-button.is-active {
  border-color: rgba(37, 99, 235, 0.44);
  background: #dbeafe;
  color: #1d4ed8;
}

.editor-menu-button {
  margin-bottom: 8px;
}

.editor-file-input {
  display: none;
}

.editor-menu-section {
  margin: 8px 0;
}

.editor-menu-section summary {
  padding: 8px 0;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.editor-create-list,
.editor-connection-list,
.editor-form,
.editor-form-actions,
.editor-sim-grid {
  display: grid;
  gap: 8px;
}

.editor-sim-grid {
  grid-template-columns: 1fr 1fr;
}

.editor-speed-field {
  margin-top: 8px;
}

.editor-sim-status {
  margin-top: 8px;
  min-height: 28px;
  border: 1px solid rgba(23, 32, 38, 0.12);
  border-radius: 6px;
  padding: 6px 7px;
  background: #f8fafc;
  color: #52616b;
  font-size: 11px;
  line-height: 1.3;
}

.editor-sim-status.is-running {
  border-color: rgba(22, 101, 52, 0.24);
  background: #dcfce7;
  color: #166534;
}

.editor-connection-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border: 1px solid rgba(23, 32, 38, 0.12);
  border-radius: 6px;
  padding: 4px 4px 4px 8px;
  background: #f8fafc;
}

.editor-connection-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: #31424f;
}

.editor-connection-row button {
  width: 26px;
  height: 24px;
  border: 1px solid rgba(180, 35, 24, 0.22);
  border-radius: 5px;
  background: #fff;
  color: #a3261d;
  cursor: pointer;
}

.editor-selection-title {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(23, 32, 38, 0.12);
  font-size: 12px;
  font-weight: 700;
  color: #31424f;
}

.editor-field {
  display: grid;
  gap: 4px;
  font-size: 11px;
  color: #52616b;
}

.editor-field input,
.editor-field select {
  width: 100%;
  min-height: 30px;
  border: 1px solid rgba(23, 32, 38, 0.16);
  border-radius: 6px;
  padding: 5px 7px;
  background: #ffffff;
  color: #172026;
  font: inherit;
  font-size: 12px;
}

.editor-field input[readonly] {
  background: #edf2f6;
  color: #66727c;
}

.editor-upload-field {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(23, 32, 38, 0.12);
  border-radius: 6px;
  background: #f8fafc;
}

.editor-upload-label {
  font-size: 11px;
  font-weight: 700;
  color: #52616b;
}

.editor-upload-summary {
  font-size: 11px;
  line-height: 1.35;
  color: #31424f;
}

.editor-upload-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.editor-upload-actions button {
  min-height: 28px;
  border: 1px solid rgba(23, 32, 38, 0.16);
  border-radius: 6px;
  background: #ffffff;
  color: #172026;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.editor-upload-actions button:hover:not(:disabled) {
  background: #e8f1f8;
}

.editor-upload-actions button:disabled {
  color: #94a3b0;
  cursor: not-allowed;
}

.editor-form-actions {
  grid-template-columns: 1fr 1fr;
  margin-top: 4px;
}

.editor-form-actions button[data-delete] {
  border-color: rgba(180, 35, 24, 0.32);
  color: #a3261d;
}

.editor-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: #66727c;
}

.editor-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(23, 32, 38, 0.42);
  backdrop-filter: blur(3px);
}

.editor-modal-overlay[hidden] {
  display: none;
}

.editor-modal {
  width: 320px;
  max-width: calc(100vw - 32px);
  border: 1px solid rgba(23, 32, 38, 0.18);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(23, 32, 38, 0.28);
}

.editor-create-modal {
  width: min(460px, calc(100vw - 32px));
}

.editor-create-modal-body {
  max-height: min(68vh, 620px);
  overflow: auto;
}

.editor-attributes-modal {
  width: min(620px, calc(100vw - 32px));
}

.editor-attributes-body {
  max-height: min(68vh, 620px);
  overflow: auto;
  padding: 0;
}

.editor-attributes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.editor-attributes-table th,
.editor-attributes-table td {
  border-bottom: 1px solid rgba(23, 32, 38, 0.1);
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
}

.editor-attributes-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #31424f;
  font-weight: 700;
}

.editor-attributes-table tbody th {
  width: 42%;
  color: #31424f;
  font-weight: 700;
  white-space: nowrap;
}

.editor-attributes-table td {
  color: #172026;
  overflow-wrap: anywhere;
}

.editor-attributes-modal .editor-modal-actions {
  grid-template-columns: 1fr;
}

.editor-create-advanced {
  border: 1px solid rgba(23, 32, 38, 0.12);
  border-radius: 8px;
  background: #f8fafc;
}

.editor-create-advanced summary {
  padding: 9px 10px;
  color: #31424f;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.editor-create-advanced-body {
  display: grid;
  gap: 10px;
  padding: 0 10px 10px;
}

.editor-modal-title {
  padding: 14px 18px 12px;
  border-bottom: 1px solid rgba(23, 32, 38, 0.12);
  font-size: 14px;
  font-weight: 700;
  color: #172026;
}

.editor-modal-body {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
}

.editor-settings-body {
  gap: 10px;
  padding: 12px 14px;
}

.editor-settings-section {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid rgba(23, 32, 38, 0.1);
  border-radius: 8px;
  background: #f8fafc;
}

.editor-settings-heading {
  color: #172026;
  font-size: 12px;
  font-weight: 700;
}

.editor-settings-toggle-grid,
.editor-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.editor-setting-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  color: #31424f;
  font-size: 12px;
  font-weight: 600;
}

.editor-setting-toggle input {
  width: 15px;
  height: 15px;
  margin: 0;
}

.editor-segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid rgba(23, 32, 38, 0.12);
  border-radius: 7px;
  background: #ffffff;
}

.editor-segmented-control label {
  margin: 0;
}

.editor-segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.editor-segmented-control span {
  display: block;
  min-height: 28px;
  padding: 7px 8px;
  border-radius: 5px;
  color: #52616b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.editor-segmented-control input:checked + span {
  background: #2563eb;
  color: #ffffff;
}

.editor-modal-field.is-muted {
  opacity: 0.52;
}

.editor-modal-field {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #52616b;
}

.editor-modal-field span {
  font-weight: 600;
  color: #31424f;
}

.editor-modal-field small {
  font-size: 10px;
  color: #94a3b0;
}

.editor-modal-field input,
.editor-modal-field select {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(23, 32, 38, 0.18);
  border-radius: 6px;
  padding: 6px 9px;
  background: #ffffff;
  color: #172026;
  font: inherit;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.editor-modal-field input:focus,
.editor-modal-field select:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.6);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.editor-modal-field input.is-invalid {
  border-color: rgba(180, 35, 24, 0.6);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.14);
}

.editor-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 18px 16px;
}

.editor-modal-actions button {
  min-height: 36px;
  border: 1px solid rgba(23, 32, 38, 0.16);
  border-radius: 6px;
  background: #f8fafc;
  color: #172026;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.editor-modal-actions button:hover {
  background: #e8f1f8;
}

.editor-modal-actions .editor-modal-apply {
  border-color: rgba(37, 99, 235, 0.44);
  background: #2563eb;
  color: #ffffff;
}

.editor-modal-actions .editor-modal-apply:hover {
  background: #1d4ed8;
}

.editor-modal-actions .editor-modal-cancel {
  border-color: rgba(180, 35, 24, 0.32);
  color: #a3261d;
}

.editor-modal-actions .editor-modal-cancel:hover {
  background: #fee2e2;
}

.editor-routing-percentages {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(23, 32, 38, 0.12);
  border-radius: 6px;
  background: #f8fafc;
}

.editor-routing-title {
  font-size: 11px;
  font-weight: 700;
  color: #52616b;
  text-transform: uppercase;
}

.editor-routing-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #31424f;
}

.editor-routing-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-routing-row input {
  min-height: 30px;
  border: 1px solid rgba(23, 32, 38, 0.16);
  border-radius: 6px;
  padding: 5px 7px;
  background: #ffffff;
  color: #172026;
  font: inherit;
  font-size: 12px;
}

.editor-routing-total {
  font-size: 11px;
  font-weight: 700;
  color: #a3261d;
}

.editor-routing-total.is-valid {
  color: #166534;
}

.editor-chamber-slots-modal {
  width: min(720px, calc(100vw - 32px));
}

.editor-chamber-slots-body {
  max-height: min(70vh, 680px);
  overflow: auto;
}

.editor-chamber-slot {
  border: 1px solid rgba(23, 32, 38, 0.12);
  border-radius: 8px;
  background: #f8fafc;
}

.editor-chamber-slot summary {
  padding: 9px 10px;
  color: #31424f;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.editor-chamber-slot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 10px 10px;
}

.editor-chamber-slot-grid .editor-field {
  margin: 0;
}

.editor-chamber-slot-grid .editor-field span {
  font-size: 10px;
}

.editor-chamber-slot-grid .editor-field input {
  min-height: 30px;
  font-size: 12px;
}

@media (max-width: 640px) {
  .editor-chamber-slot-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.editor-shift-modal {
  width: 360px;
}

.editor-shift-time-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.editor-shift-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.editor-shift-day {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 44px;
  border: 1px solid rgba(23, 32, 38, 0.12);
  border-radius: 6px;
  background: #f8fafc;
  color: #31424f;
  font-size: 11px;
  cursor: pointer;
}

.editor-shift-day input {
  margin: 0;
  accent-color: #2563eb;
}

.editor-bulk-modal {
  width: min(980px, calc(100vw - 32px));
}

.editor-import-preview-modal {
  width: min(620px, calc(100vw - 32px));
}

.editor-import-preview,
.editor-import-preview-section {
  display: grid;
  gap: 8px;
}

.editor-import-preview-summary {
  color: #31424f;
  font-size: 12px;
  line-height: 1.45;
}

.editor-import-preview-section {
  gap: 3px;
  padding: 8px;
  border: 1px solid rgba(23, 32, 38, 0.12);
  border-radius: 6px;
  background: #f8fafc;
}

.editor-import-preview-title {
  color: #52616b;
  font-size: 11px;
  font-weight: 700;
}

.editor-import-preview-list,
.editor-import-preview-empty {
  color: #172026;
  font-size: 12px;
  line-height: 1.35;
}

.editor-import-preview-empty {
  color: #78909c;
}

.editor-bulk-tools {
  display: grid;
  grid-template-columns: repeat(6, minmax(90px, 1fr)) repeat(3, auto);
  gap: 8px;
  align-items: end;
}

.editor-bulk-tool {
  display: grid;
  gap: 3px;
  color: #52616b;
  font-size: 11px;
}

.editor-bulk-tool input,
.editor-bulk-tool select {
  min-height: 30px;
  border: 1px solid rgba(23, 32, 38, 0.16);
  border-radius: 6px;
  padding: 5px 7px;
  background: #fff;
  color: #172026;
  font: inherit;
}

.editor-bulk-tools button {
  min-height: 30px;
  border: 1px solid rgba(23, 32, 38, 0.16);
  border-radius: 6px;
  background: #fff;
  color: #172026;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.editor-bulk-table-wrap {
  max-height: min(62vh, 560px);
  overflow: auto;
  border: 1px solid rgba(23, 32, 38, 0.12);
  border-radius: 6px;
}

.editor-bulk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.editor-bulk-table th,
.editor-bulk-table td {
  border-bottom: 1px solid rgba(23, 32, 38, 0.1);
  padding: 6px;
  text-align: left;
  white-space: nowrap;
}

.editor-bulk-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #31424f;
  font-weight: 700;
}

.editor-bulk-table input,
.editor-bulk-table select {
  min-width: 86px;
  max-width: 160px;
  min-height: 30px;
  border: 1px solid rgba(23, 32, 38, 0.16);
  border-radius: 6px;
  padding: 4px 6px;
  background: #ffffff;
  color: #172026;
  font: inherit;
}

.editor-bulk-table input[type="checkbox"] {
  min-width: auto;
  max-width: none;
  min-height: auto;
}

/* ====== Reports Panel ====== */
.editor-reports-panel {
  position: absolute;
  right: 288px;
  bottom: 16px;
  z-index: 25;
  width: 460px;
  max-width: calc(100vw - 320px);
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  border: 1px solid rgba(23, 32, 38, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 18px 44px rgba(23, 32, 38, 0.22);
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.editor-reports-panel.is-hidden {
  display: none;
}

.editor-reports-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(23, 32, 38, 0.12);
  background: #f8fafc;
}

.editor-reports-title {
  font-size: 13px;
  font-weight: 700;
  color: #172026;
}

.editor-reports-close {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(23, 32, 38, 0.16);
  border-radius: 6px;
  background: #fff;
  color: #52616b;
  font-size: 12px;
  cursor: pointer;
}

.editor-reports-close:hover {
  background: #fee2e2;
  color: #a3261d;
}

.editor-reports-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 14px 0;
}

.editor-reports-tab {
  flex: 1;
  min-height: 30px;
  border: 1px solid rgba(23, 32, 38, 0.16);
  border-radius: 6px;
  background: #f8fafc;
  color: #52616b;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.editor-reports-tab.is-active {
  border-color: rgba(37, 99, 235, 0.44);
  background: #dbeafe;
  color: #1d4ed8;
}

.editor-reports-actions {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
}

.editor-reports-actions button {
  flex: 1;
  min-height: 28px;
  border: 1px solid rgba(23, 32, 38, 0.16);
  border-radius: 6px;
  background: #ffffff;
  color: #172026;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.editor-reports-actions button:hover {
  background: #e8f1f8;
  border-color: rgba(37, 99, 235, 0.44);
  color: #1d4ed8;
}

.editor-reports-summary {
  padding: 0 14px 8px;
  font-size: 11px;
  color: #52616b;
  font-variant-numeric: tabular-nums;
}

.editor-reports-summary strong {
  color: #172026;
}

.editor-reports-body {
  flex: 1;
  overflow: auto;
  padding: 0 14px 14px;
}

.editor-reports-subtitle {
  margin: 10px 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #52616b;
}

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

.editor-reports-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 6px 8px;
  text-align: left;
  background: #f1f5f9;
  color: #31424f;
  font-weight: 700;
  border-bottom: 1px solid rgba(23, 32, 38, 0.14);
  white-space: nowrap;
}

.editor-reports-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(23, 32, 38, 0.08);
  color: #172026;
  white-space: nowrap;
}

.editor-reports-table tbody tr:hover {
  background: #f8fafc;
}

@media (max-width: 860px) {
  :root {
    --editor-safe-left: 16px;
  }

  .hud,
  #status {
    left: var(--editor-safe-left);
  }

  .hud {
    top: auto;
    bottom: 60px;
  }

  .editor-sidebar {
    right: 16px;
    bottom: auto;
    width: 52px;
    max-height: 38vh;
  }

  .editor-sidebar:not(.is-collapsed) {
    width: calc(100% - 32px);
  }

  .editor-properties {
    top: auto;
    left: 16px;
    right: 16px;
    bottom: 104px;
    width: auto;
    max-height: 36vh;
  }

  .editor-properties.is-collapsed {
    transform: translateY(calc(100% - 14px));
  }

  .editor-console {
    min-width: 0;
    width: calc(100% - 32px);
    bottom: 12px;
  }

  .editor-console-speed input[type="range"] {
    width: 100px;
  }
}
