body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #1e1e1e;
  color: #fff;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 48px;
  flex-shrink: 0;
  background: #2a2a2a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid #3a3a3a;
  gap: 16px;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
}

.logo img {
  height: 40px;
  width: auto;
  display: block;
}

.menu {
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-item {
  position: relative;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.menu-item:hover,
.menu-item.active {
  background: #3a3a3a;
  color: #ffffff;
}

.dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #2d2d2d;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  min-width: 160px;
  display: none;
  flex-direction: column;
  padding: 4px 0;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.dropdown-item {
  display: block;
  box-sizing: border-box;
  padding: 8px 12px;
  font-size: 8px;
  color: #ccc;
  background: transparent;
  border: none;
  text-align: left;
  width: 100%;
  cursor: pointer;
}

.dropdown-item:hover {
  background: #3a3a3a;
  color: #ffffff;
}

.button-reset {
  font: inherit;
}

.dropdown-item.button-reset {
  display: block;
  box-sizing: border-box;
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.dropdown-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  user-select: none;
}

.dropdown-checkbox-item input[type="checkbox"] {
  margin: 0;
}

.document-toolbar {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar-btn,
.toolbar-select,
.document-status {
  height: 32px;
  border-radius: 6px;
  border: 1px solid #4a4a4a;
  background: #1f1f1f;
  color: #e6e6e6;
  box-sizing: border-box;
}

.toolbar-btn {
  padding: 0 12px;
  cursor: pointer;
}

.toolbar-btn:hover:not(:disabled) {
  background: #2a2a2a;
}

.toolbar-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.toolbar-select {
  min-width: 120px;
  padding: 0 10px;
}

.rotation-toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rotation-toolbar-btn {
  min-width: 36px;
  padding: 0 10px;
  font-size: 16px;
  line-height: 1;
}

.rotation-readout {
  min-width: 108px;
  justify-content: center;
  font-size: 12px;
}

.rotation-readout.is-disabled {
  opacity: 0.65;
}

#measure-toggle-btn {
  background: #2a2a2a;
  color: #ccc;
  border: 1px solid #444;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
}

#measure-toggle-btn:hover {
  background: #333;
  color: #fff;
}
#measure-toggle-btn.active {
  background: #2a5fff;
  color: #fff;
  border-color: #2a5fff;
}

.document-status {
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-size: 13px;
  color: #cccccc;
}

.app-container {
  flex: 1;
  display: flex;
  min-height: 0;
}
.main-stack {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.top-work-area {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
}

.sidebar {
  width: 260px;
  background: #252526;
  border-right: 1px solid #3a3a3a;
  padding: 12px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.sidebar.right {
  border-left: 1px solid #3a3a3a;
  border-right: none;
}

.sidebar.left,
.sidebar.right {
  flex-shrink: 0;
}

.accessories-sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.selected-device-preview {
  flex: 0 0 auto;
  min-height: 140px;
  overflow: hidden;
  min-width: 0;
}

.sidebar-section {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.sidebar-section-header h3 {
  margin: 0;
  font-size: 16px;
}

.accessories-search-input {
  width: 120px;
  min-width: 0;
  height: 28px;
  box-sizing: border-box;
  border-radius: 6px;
  border: 1px solid #3a3a3a;
  background: #1f1f1f;
  color: #e6e6e6;
  padding: 0 10px;
  font-size: 12px;
}

.accessories-search-input::placeholder {
  color: #9a9a9a;
}

.preview-panel-resizer {
  height: 12px;
  flex: 0 0 auto;
  cursor: row-resize;
  margin: 8px 0;
  border-radius: 999px;
  background: transparent;
  transition: background 0.15s ease;
}

.preview-panel-resizer:hover {
  background: #3a3a3a;
}

.preview-panel-resizer:active {
  background: #4a4a4a;
}

.sidebar-section-header--preview {
  margin-bottom: 0;
  padding-top: 12px;
  border-top: 1px solid #3a3a3a;
}

.btn-compact {
  padding: 6px 10px;
  font-size: 12px;
}

.accessories-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 140px;
  overflow: auto;
  padding-right: 2px;
}

.accessories-empty-state {
  border: 1px dashed #4a4a4a;
  border-radius: 8px;
  padding: 14px;
  color: #b8b8b8;
  background: #202021;
  font-size: 13px;
  line-height: 1.4;
}

.accessory-symbol-card {
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background: #202021;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.accessory-symbol-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.accessory-symbol-title-wrap {
    flex: 1;
    min-width: 0;
}

.accessory-symbol-title {
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.accessory-symbol-subtitle {
  margin-top: 4px;
  font-size: 11px;
  color: #9a9a9a;
}

.accessory-symbol-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.accessory-symbol-count {
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid #4a4a4a;
  background: #1a1a1a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.accessory-symbol-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.accessory-line-header,
.accessory-line-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px 30px 34px;
  gap: 8px;
  align-items: center;
}

.accessory-line-header {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8f8f8f;
}

.accessory-line-item {
  font-size: 12px;
  border-radius: 6px;
  padding: 4px 6px;
}

.accessory-line-item[role="button"] {
  cursor: pointer;
}

.accessory-line-item[role="button"]:hover {
  background: #2a2a2a;
}

.accessory-line-item[role="button"]:focus-visible {
  outline: 1px solid #7fb3ff;
  outline-offset: 1px;
}

.accessory-line-item.is-selected {
  background: #2a3558;
}

.accessory-line-main {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accessory-qty-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 50px;
  justify-self: end;
}

.accessory-qty-field span {
  display: none;
}

.accessory-qty-field input {
  width: 100%;
  height: 28px;
  box-sizing: border-box;
  border-radius: 6px;
  border: 1px solid #4a4a4a;
  background: #161616;
  color: #f0f0f0;
  padding: 0 8px;
}

.accessory-total {
  text-align: center;
  font-weight: 700;
}

.accessory-remove-btn {
  min-width: 0;
  width: 34px;
  padding: 0;
  line-height: 1;
}

.accessory-none {
  color: #a8a8a8;
  font-size: 12px;
}

.accessory-picker-modal {
  width: min(760px, calc(100vw - 32px));
}

.accessory-picker-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.accessory-picker-context {
  font-size: 13px;
  color: #cfcfcf;
}

.accessory-picker-search {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.accessory-picker-search input {
  height: 34px;
  border-radius: 6px;
  border: 1px solid #4a4a4a;
  background: #1b1b1b;
  color: #efefef;
  padding: 0 10px;
}

.accessory-picker-results {
  max-height: 420px;
  overflow: auto;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background: #1c1c1d;
}

.accessory-picker-row {
  width: 100%;
  border: none;
  border-bottom: 1px solid #2f2f2f;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.accessory-picker-row:last-child {
  border-bottom: none;
}

.accessory-picker-row:hover,
.accessory-picker-row.is-selected {
  background: #2a3558;
}

.accessory-picker-row-text {
  font-size: 12px;
  line-height: 1.35;
}

.accessory-picker-row-state {
  flex-shrink: 0;
  font-size: 11px;
  color: #c3d5ff;
}

.accessory-picker-empty {
  padding: 14px;
  color: #b8b8b8;
  font-size: 13px;
}

.accessory-picker-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.selected-device-preview-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid #3a3a3a;
  padding-top: 12px;
  height: 100%;
  min-height: 0;
}


.selected-device-preview-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
}

.selected-device-preview-title {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
}

.selected-device-preview-subtitle {
  font-size: 12px;
  color: #a8a8a8;
  line-height: 1.35;
}

.selected-device-preview-spec-link {
  padding: 0;
  color: #7fb3ff;
  background: transparent;
  border: none;
  text-decoration: underline;
  cursor: pointer;
}

.selected-device-preview-spec-link:hover {
  color: #a9ccff;
}

.selected-device-preview-spec-link:focus-visible {
  outline: 1px solid #7fb3ff;
  outline-offset: 2px;
  border-radius: 2px;
}

.selected-device-preview-image-wrap {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background: #1a1a1a;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.selected-device-preview-image {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

.selected-device-preview-empty {
  font-size: 12px;
  color: #999999;
  line-height: 1.4;
}

.symbol-sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.symbol-sidebar-search {
  margin-bottom: 12px;
}

.symbol-sidebar-search input {
  width: 100%;
  box-sizing: border-box;
  background: #1f1f1f;
  color: #e6e6e6;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  padding: 8px 10px;
}

.symbol-sidebar-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 6px;
}

.symbol-sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px;
  border-radius: 6px;

  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  justify-content: flex-start;
}

.symbol-sidebar-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.symbol-sidebar-item:hover,
.symbol-sidebar-item.active {
  background: #3a3a3a;
}

.symbol-sidebar-item.active {
  outline: 1px solid #4b4b4b;
}

.symbol-sidebar-empty {
  padding: 12px;
  border: 1px dashed rgba(255,255,255,0.18);
  border-radius: 8px;
  color: rgba(255,255,255,0.72);
  font-size: 12px;
  line-height: 1.4;
}



.symbol-info {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: #e6e6e6;
}

.symbol-info span {
  color: #bdbdbd;
}

.legend-action-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #3a3a3a;
}

#generate-legend-btn {
  width: 100%;
  height: 34px;
  font-size: 12px;
}

.center-column {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.workspace {
  flex: 1;
  min-width: 0;
  min-height: 120px;
  background: #1e1e1e;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  box-sizing: border-box;
}

.workspace-canvas {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  padding: 8px;
  box-sizing: border-box;
  overflow: hidden;
}

.document-stage {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-top: 6px;
}

.document-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #cfcfcf;
  text-align: center;
  gap: 8px;
}

.document-empty-title {
  font-size: 24px;
  font-weight: 600;
}

.document-empty-subtitle {
  font-size: 14px;
  color: #a9a9a9;
}

.document-loading-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #3a3a3a;
  border-top-color: #7fb3ff;
  border-radius: 50%;
  animation: document-spinner-spin 0.8s linear infinite;
  margin-bottom: 6px;
}

.document-empty-state.is-loading .document-empty-title {
  font-size: 22px;
}

.document-empty-state.is-loading .document-empty-subtitle {
  max-width: 420px;
  line-height: 1.5;
}

@keyframes document-spinner-spin {
  to {
    transform: rotate(360deg);
  }
}

.pdf-viewer {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pdf-meta {
  font-size: 13px;
  color: #d6d6d6;
}

.pdf-canvas-shell {
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  background: transparent;
  border-radius: 8px;
  overflow: auto;
  padding: 0;
  box-sizing: border-box;
  display: block;
  position: relative;
}

#pdf-canvas {
  display: block;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.pdf-canvas-container {
  position: relative;
  display: inline-block;
}

#symbol-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

#overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  pointer-events: none;
}

.placed-symbol {
  position: absolute;
  transform: translate(-50%, -50%);
  user-select: none;
  cursor: move;
  pointer-events: auto;
  box-sizing: border-box;
}

.placed-symbol.selected {
  outline: 2px solid #00b7ff;
  outline-offset: 4px;
}

.placed-symbol-svg {
  width: 100%;
  height: 100%;
}

.placed-symbol-svg .symbol-svg {
  width: 100%;
  height: 100%;
}

.symbol-resize-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  right: -6px;
  bottom: -6px;
  border-radius: 50%;
  background: #00b7ff;
  border: 2px solid #ffffff;
  cursor: nwse-resize;
  display: none;
  box-sizing: border-box;
}

.placed-symbol.selected .symbol-resize-handle {
  display: block;
}


.panel-resizer {
  height: 6px;
  background: #2a2a2a;
  border-top: 1px solid #3a3a3a;
  border-bottom: 1px solid #3a3a3a;
  cursor: row-resize;
  flex-shrink: 0;
}

.panel-resizer:hover {
  background: #343434;
}

.panel-resizer-vertical {
  width: 6px;
  height: auto;
  border-top: none;
  border-bottom: none;
  border-left: 1px solid #3a3a3a;
  border-right: 1px solid #3a3a3a;
  cursor: col-resize;
}

.bottom-panel {
  height: 260px;
  min-height: 80px;
  max-height: 400px;
  background: #1b1b1b;
  padding: 12px;
  box-sizing: border-box;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.device-explorer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  position: relative;
}

.device-explorer-controls {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.device-explorer-columns-btn {
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid #4a4a4a;
  background: #1f1f1f;
  color: #e6e6e6;
  font-size: 12px;
  cursor: pointer;
}

.device-explorer-columns-btn:hover {
  background: #2a2a2a;
}

.device-explorer-columns-btn[aria-expanded="true"] {
  background: #2d2d2d;
  border-color: #5a5a5a;
}

.device-explorer-columns-caret {
  margin-left: 4px;
  font-size: 11px;
}

.device-explorer-columns-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  max-height: 260px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #3f3f3f;
  background: #222222;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  z-index: 1200;
}

.device-explorer-columns-menu-title {
  font-size: 12px;
  font-weight: 600;
  color: #d8d8d8;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #343434;
}

.device-explorer-columns-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  font-size: 12px;
  color: #d0d0d0;
  cursor: pointer;
  user-select: none;
}

.device-explorer-columns-menu-item:hover {
  color: #ffffff;
}

.device-explorer-columns-menu-item input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.device-explorer-columns-menu-item.locked {
  opacity: 0.7;
  cursor: default;
}

.device-explorer-shell {
  width: 100%;
  min-width: 0;
  height: calc(100% - 40px);
  overflow: auto;
  border: 1px solid #333333;
  border-radius: 8px;
  background: #171717;
}

.device-explorer-table {
  width: auto;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
  color: #d7d7d7;
}

.device-explorer-table th,
.device-explorer-table td {
  padding: 8px 10px;
  border-right: 1px solid #2f2f2f;
  border-bottom: 1px solid #2a2a2a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

.device-explorer-table th:last-child,
.device-explorer-table td:last-child {
  border-right: none;
}

.device-explorer-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #202020;
  text-align: left;
  font-weight: 600;
  color: #efefef;
}

.device-explorer-header-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 10px;
}

.device-explorer-col-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 2;
}

.device-explorer-table th {
  position: sticky;
}

.device-explorer-table th[data-column-key] {
  position: sticky;
}

.device-explorer-col-resizer::after {
  content: "";
  position: absolute;
  top: 5px;
  bottom: 5px;
  left: 3px;
  width: 2px;
  border-radius: 2px;
  background: transparent;
}

.device-explorer-col-resizer:hover::after,
.device-explorer-col-resizer.active::after {
  background: #6ea8ff;
}

.device-explorer-empty-row td {
  text-align: center;
  color: #9c9c9c;
  font-style: italic;
  padding: 16px 10px;
}

.bottom-panel-title,
.panel-header {
  font-size: 14px;
  font-weight: 600;
  color: #d6d6d6;
}

.device-explorer-shell {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  border: 1px solid #323232;
  border-radius: 6px;
  background: #151515;
}

.device-explorer-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.device-explorer-table col {
  min-width: 60px;
}

.device-explorer-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.device-explorer-table th,
.device-explorer-table td {
  border-right: 1px solid #2f2f2f;
  border-bottom: 1px solid #2a2a2a;
  padding: 8px 10px;
  box-sizing: border-box;
  font-size: 12px;
  text-align: left;

  /* changed for wrapping */
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  word-break: break-word;
  vertical-align: top;
}

.device-explorer-table th:last-child,
.device-explorer-table td:last-child {
  border-right: none;
}

.device-explorer-table th {
  position: relative;
  background: #202020;
  color: #e6e6e6;
  font-weight: 600;
  user-select: none;
}

.device-explorer-table td {
  color: #cfcfcf;
  background: #171717;
}

.device-explorer-header-label {
  display: block;
  padding-right: 12px;

  /* allow header text to wrap too */
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.device-explorer-col-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
}

.device-explorer-col-resizer:hover,
.device-explorer-col-resizer.active {
  background: rgba(42, 95, 255, 0.45);
}

.device-explorer-empty-row td {
  color: #8f8f8f;
  font-style: italic;
}


.device-explorer-inline-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d6d6d6;
  font-size: 12px;
}

.device-explorer-inline-control span {
  white-space: nowrap;
}

.device-explorer-toolbar-select {
  min-width: 160px;
}

.device-explorer-search-control {
  gap: 8px;
}

.device-explorer-search-input,
.device-explorer-cell-input,
.device-explorer-cell-select,
.device-explorer-header-btn {
  font: inherit;
}

.device-explorer-search-input {
  height: 30px;
  min-width: 180px;
  border-radius: 6px;
  border: 1px solid #4a4a4a;
  background: #1f1f1f;
  color: #e6e6e6;
  padding: 0 10px;
  box-sizing: border-box;
}

.device-explorer-header-btn {
  display: block;
  width: calc(100% - 8px);
  padding: 0;
  background: transparent;
  border: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.device-explorer-header-btn:hover .device-explorer-header-label {
  color: #ffffff;
}

.device-explorer-row {
  cursor: pointer;
}

.device-explorer-row:hover td {
  background: #1d1d1d;
}

.device-explorer-cell-input,
.device-explorer-cell-select {
  width: 100%;
  min-width: 0;
  height: 26px;
  border-radius: 4px;
  border: 1px solid #3f3f3f;
  background: #111111;
  color: #e6e6e6;
  box-sizing: border-box;
}

.device-explorer-cell-input {
  padding: 0 8px;
}

.device-explorer-cell-select {
  padding: 0 6px;
}

.hidden {
  display: none !important;
}

.btn {
  background: #3a3a3a;
  color: #f0f0f0;
  border: 1px solid #4a4a4a;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
}

.btn:hover {
  background: #464646;
}

.btn.primary {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #ffffff;
}

.btn.primary:hover {
  background: #2b7cff;
}

.btn.danger {
  background: #5a2a2a;
  border-color: #6a3333;
  color: #ffffff;
}

.btn.danger:hover {
  background: #6a3333;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  overflow-y: auto;
  z-index: 2000;
}

.modal {
  width: 900px;
  max-width: 90vw;
  height: 560px;
  max-height: 85vh;
  background: #252526;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.modal-header {
  height: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #3a3a3a;
  background: #2a2a2a;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  color: #f0f0f0;
}

.modal-close {
  background: transparent;
  border: none;
  color: #cccccc;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  color: #ffffff;
}

.modal-body {
  flex: 1;
  display: flex;
  min-height: 0;
  padding: 16px 10px;
}

.about-modal {
  width: 560px;
  max-width: 92vw;
  height: auto;
  max-height: 85vh;
}

.about-modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 16px;
  box-sizing: border-box;
}

.about-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.about-app-title {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
}

.about-app-version {
  font-size: 14px;
  color: #b7bec7;
}

.about-section-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8f98a3;
}

.about-copy {
  font-size: 13px;
  line-height: 1.5;
  color: #d5d9df;
}

.about-meta-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 12px;
  font-size: 13px;
  color: #d5d9df;
}

.about-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}



.symbol-list-panel,
.symbol-form-panel {
  padding: 16px;
  box-sizing: border-box;
}

.symbol-list-panel {
  width: 300px;
  border-right: 1px solid #3a3a3a;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.symbol-form-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.symbol-list {
  flex: 1;
  overflow-y: auto;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  background: #1f1f1f;
}

.symbol-manager-modal {
  height: 720px;
  max-height: 92vh;
}

.symbol-manager-body {
  min-height: 0;
}

.symbol-list-item {
  padding: 10px 12px;
  border-bottom: 1px solid #2f2f2f;
  cursor: pointer;
  color: #e6e6e6;
  background:#1b1b1b
}

.symbol-list-item:last-child {
  border-bottom: none;
}

.symbol-list-item:hover,
.symbol-list-item.active {
  background: #343434;
}

.symbol-form-panel label {
  font-size: 13px;
  color: #cccccc;
}

.symbol-form-panel input[type="text"],
.symbol-form-panel input[type="color"],
.symbol-form-panel select {
  background: #1f1f1f;
  color: #e6e6e6;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  padding: 8px 10px;
  box-sizing: border-box;
}

.symbol-form-panel input[type="color"] {
  padding: 4px;
  height: 40px;
  flex-shrink: 0;
}

.form-actions {
  margin-top: auto;
  padding-top: 12px;
  padding-bottom: 2px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(37, 37, 38, 0), rgba(37, 37, 38, 0.95) 20%, #252526 100%);
}


.database-manager-modal {
  width: 1120px;
  max-width: 94vw;
  height: 760px;
  max-height: 92vh;
}

.database-manager-body {
  flex-direction: column;
  padding: 16px;
  gap: 16px;
  box-sizing: border-box;
  overflow: hidden;
}

.database-manager-scroll-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding-right: 4px;
}

.database-manager-topbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.database-manager-intro {
  font-size: 13px;
  line-height: 1.45;
  color: #b7bec7;
  max-width: 980px;
}

.database-manager-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.database-manager-active-catalog {
  font-size: 13px;
  color: #d5d9df;
}

.database-manager-active-catalog strong {
  color: #f3f4f6;
}

.database-manager-subtle {
  color: #8f98a3;
}

.database-manager-folder-control {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #e6e6e6;
  font-size: 15px;
}

.database-manager-folder-control span {
  font-size: 16px;
  font-weight: 600;
}

.database-manager-folder-control select {
  min-width: 240px;
  height: 38px;
  border-radius: 6px;
  border: 1px solid #3a3a3a;
  background: #1f1f1f;
  color: #e6e6e6;
  padding: 0 10px;
}

.database-manager-content {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(360px, 1fr);
  gap: 16px;
  align-items: start;
}

.database-card {
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  padding: 16px;
  box-sizing: border-box;
  min-height: 0;
}

.database-add-part-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.database-add-part-panel label,
.database-file-block-label,
.database-search-row span {
  font-size: 13px;
  color: #d0d5db;
}

.database-add-part-panel input[type="text"],
.database-search-row input,
.database-file-picker-row input[type="file"] {
  width: 100%;
  box-sizing: border-box;
  background: #1f1f1f;
  color: #e6e6e6;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  padding: 8px 10px;
}

.database-file-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.database-file-picker-row {
  display: flex;
  align-items: center;
}

.database-file-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.database-file-status {
  font-size: 12px;
  color: #97a0ab;
}

.database-photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.database-editing-state {
  margin-top: 6px;
  font-size: 12px;
  color: #97a0ab;
}

.database-editing-state span {
  color: #d5d9df;
}

.database-form-actions {
  margin-top: 6px;
  padding-top: 14px;
  padding-bottom: 2px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.database-quick-view-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.database-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.database-search-row span {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 600;
}

.database-quick-status {
  font-size: 13px;
  color: #9ca3af;
}

.database-quick-results {
  flex: 1;
  min-height: 0;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  background: #1f1f1f;
  padding: 14px;
  overflow-y: auto;
}

.database-quick-results-empty {
  color: #8f98a3;
  font-size: 13px;
  line-height: 1.5;
}

.database-quick-row {
  width: 100%;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  text-align: left;
}

.database-quick-row-thumb {
  width: 56px;
  height: 56px;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background: #181818;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.database-quick-row-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #111111;
}

.database-quick-row-thumb.is-empty,
.database-quick-thumb-loading {
  color: #8f98a3;
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  padding: 4px;
}

.database-quick-row-thumb.is-empty span,
.database-quick-row-thumb .database-quick-thumb-loading,
.database-quick-row-thumb > span {
  display: block;
}

.database-quick-row-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.database-quick-row-text strong,
.database-quick-row-text span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.database-quick-row-text strong {
  color: #f0f3f7;
  white-space: normal;
  line-height: 1.25;
}

.database-quick-row-text span {
  color: #aeb6c2;
  font-size: 12px;
  white-space: nowrap;
}


.database-manager-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid #3a3a3a;
  flex-shrink: 0;
}

@media (max-width: 980px) {
  .database-manager-content {
    grid-template-columns: 1fr;
  }

  .database-photo-grid {
    grid-template-columns: 1fr;
  }

  .database-manager-folder-control {
    width: 100%;
    justify-content: space-between;
  }

  .database-manager-folder-control select {
    min-width: 0;
    width: 100%;
    max-width: 320px;
  }

  .database-search-row {
    flex-direction: column;
    align-items: stretch;
  }
}


@media (max-width: 1280px) {
  .topbar {
    align-items: flex-start;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .sidebar {
    width: 220px;
  }

  .workspace-canvas {
    width: 96%;
    height: 92%;
  }
}

/*Page Manager */
.page-manager-modal {
  width: 980px;
  max-width: 92vw;
  height: 620px;
  max-height: 88vh;
}

.page-manager-body {
  padding: 0;
}

.page-manager-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  box-sizing: border-box;
  gap: 12px;
}

.page-manager-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  background: #1f1f1f;
}

.page-manager-empty {
  padding: 16px;
  color: #9ca3af;
  font-size: 13px;
}

.page-manager-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 130px 170px;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #2f2f2f;
}

.page-manager-row:last-child {
  border-bottom: none;
}

.page-row-index {
  color: #9ca3af;
  font-size: 13px;
}

.page-row-name input {
  width: 100%;
  background: #252526;
  color: #f3f4f6;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  padding: 8px 10px;
  box-sizing: border-box;
}

.page-row-size {
  color: #d1d5db;
  font-size: 13px;
}

.page-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.page-action-btn {
  min-width: 72px;
}

.page-manager-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.symbol-sidebar-preview,
.symbol-list-item-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.symbol-sidebar-preview {
  width: 54px;
}

.symbol-list-item-preview {
  width: 56px;
}

.symbol-svg {
  display: block;
}

.symbol-sidebar-item {
  align-items: center;
  gap: 12px;
}

.symbol-info {
  min-width: 0;
}

.symbol-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.symbol-list-item-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.symbol-list-item-text strong,
.symbol-info strong {
  color: #f3f4f6;
}

.symbol-list-item-text span,
.symbol-info span {
  color: #bdbdbd;
}

.symbol-preview-block {
  margin-top: 8px;
  padding: 12px;
  flex-shrink: 0;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  background: #1f1f1f;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.symbol-preview-label {
  font-size: 13px;
  color: #cccccc;
}

.symbol-preview-canvas {
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #3f3f46;
  border-radius: 6px;
  background: repeating-linear-gradient(
    45deg,
    #202020,
    #202020 12px,
    #232323 12px,
    #232323 24px
  );
}

.active-symbol-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 112px;
  padding: 14px 0 18px;
}


.parts-manager-modal {
  width: 980px;
  max-width: 94vw;
  height: 760px;
  max-height: calc(100vh - 48px);
}

.parts-manager-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  box-sizing: border-box;
  overflow: hidden;
}

.parts-manager-intro {
  font-size: 13px;
  line-height: 1.5;
  color: #b7bec7;
}

.parts-manager-intro code {
  color: #d9dee5;
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 4px;
  border-radius: 4px;
}

.parts-manager-tabs {
  display: inline-flex;
  gap: 10px;
}

.parts-manager-tab {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid #4a4a4a;
  background: #2a2a2a;
  color: #e5e7eb;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.parts-manager-tab.is-active {
  background: #0e639c;
  border-color: #1177bb;
  color: #ffffff;
}

.parts-manager-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.parts-manager-search,
.parts-manager-folder-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.parts-manager-search span,
.parts-manager-folder-control span {
  font-size: 14px;
  font-weight: 600;
  color: #e6e6e6;
  flex-shrink: 0;
}

.parts-manager-search input,
.parts-manager-folder-control select {
  height: 38px;
  border-radius: 6px;
  border: 1px solid #3a3a3a;
  background: #1f1f1f;
  color: #e6e6e6;
  padding: 0 10px;
  box-sizing: border-box;
}

.parts-manager-search input {
  width: 320px;
  max-width: 100%;
}

.parts-manager-folder-control select {
  min-width: 180px;
}

.parts-manager-status-card {
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background: #252526;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.parts-manager-status-title {
  font-size: 13px;
  color: #cfd5dc;
}

.parts-manager-status-title strong {
  color: #f3f4f6;
}

.parts-manager-status-title span,
.parts-manager-status-message {
  color: #97a0ab;
}

.parts-manager-status-message {
  font-size: 13px;
}

.parts-manager-results {
  flex: 1;
  min-height: 180px;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background: #1f1f1f;
  padding: 14px;
  overflow: auto;
}

.parts-manager-results-empty {
  font-size: 13px;
  line-height: 1.5;
  color: #8f98a3;
}

.parts-manager-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid #3a3a3a;
  flex-wrap: wrap;
}


.parts-manager-table {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.parts-manager-row {
  display: grid;
  grid-template-columns: 48px 72px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid #313131;
  border-radius: 10px;
  background: linear-gradient(180deg, #222222 0%, #1f1f1f 100%);
}

.parts-manager-remote-row {
  grid-template-columns: 48px 72px minmax(0, 1fr) auto;
}


.parts-manager-row-index {
  font-size: 14px;
  font-weight: 700;
  color: #f3f4f6;
  line-height: 1.2;
  padding-top: 2px;
}

.parts-manager-row-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.parts-manager-row-thumb:hover {
  background: #202020;
  border-color: #4a4a4a;
}

.parts-manager-row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* keeps full product visible */
}

.parts-manager-row-thumb-empty {
  cursor: default;
  color: #8f98a3;
  font-size: 11px;
  text-align: center;
  padding: 6px;
  line-height: 1.2;
}

.parts-manager-row-thumb-empty span {
  display: block;
}



.parts-manager-row-main {
  min-width: 0;
}

.parts-manager-row-label {
  font-size: 16px;
  font-weight: 700;
  color: #f3f4f6;
  line-height: 1.35;
}

.parts-manager-row-subtle {
  margin-top: 8px;
  font-size: 13px;
  color: #aeb6c1;
}

.parts-update-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  margin-left: 8px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.18);
  color: #dbeafe;
  font-size: 12px;
  font-weight: 700;
  text-transform: lowercase;
}

.parts-manager-row-linker {
  margin-top: 12px;
}

.parts-manager-symbol-link-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 600;
  color: #d6d6d6;
}

.parts-manager-symbol-link-select {
  height: 32px;
  min-width: 220px;
  border-radius: 6px;
  border: 1px solid #3a3a3a;
  background: #1f1f1f;
  color: #e6e6e6;
  padding: 0 10px;
  box-sizing: border-box;
}

.parts-manager-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 840px) {
  .parts-manager-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .parts-manager-search,
  .parts-manager-folder-control {
    width: 100%;
  }

  .parts-manager-search input,
  .parts-manager-folder-control select {
    width: 100%;
    min-width: 0;
  }

  .parts-manager-row {
    grid-template-columns: 48px 64px minmax(0, 1fr);
  }

  .parts-manager-row-thumb {
    width: 64px;
    height: 64px;
  }

  .parts-manager-row-actions {
    grid-column: 2 / -1;
    justify-content: flex-start;
    margin-top: 10px;
  }
}

.device-explorer-row.selected td {
  background: #16324a;
}

.device-explorer-row.selected:hover td {
  background: #1b3d59;
}

 /* Legend Block */
.legend-block {
  position: absolute;
  transform: translate(-50%, -50%);
  user-select: none;
  cursor: move;
  pointer-events: auto;
  box-sizing: border-box;
}

.legend-block.selected {
  outline: 2px solid #00b7ff;
  outline-offset: 4px;
}

.legend-block-content {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--legend-base-width, 240px);
  height: var(--legend-base-height, 200px);
  transform-origin: top left;
  transform: scale(var(--legend-scale, 1));
}

.legend-block-card {
  width: 100%;
  height: 100%;
  padding: var(--legend-pad, 8px);
  color: #222;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: var(--legend-body-gap, 6px);
  font-size: var(--legend-body-font, 12px);
  background: #ffffff;
  border: none;
}

.legend-block-title {
  font-size: var(--legend-title-font, 13px);
  font-weight: 600;
  line-height: 1.2;
}

.legend-block-body {
  display: flex;
  flex-direction: column;
  gap: var(--legend-row-gap, 6px);
}

.legend-block-row {
  display: grid;
  grid-template-columns: var(--legend-swatch-column, 26px) 1fr;
  align-items: center;
  column-gap: 8px;
}

.legend-block-swatch {
  width: var(--legend-swatch-size, 24px);
  height: var(--legend-swatch-size, 24px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.legend-block-swatch svg {
  width: var(--legend-swatch-size, 24px);
  height: var(--legend-swatch-size, 24px);
  display: block;
}

.legend-block-name {
  font-size: var(--legend-body-font, 12px);
  line-height: 1.2;
  color: #222;
  white-space: normal;
  word-break: break-word;
}

.legend-resize-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  right: -6px;
  bottom: -6px;
  border-radius: 50%;
  background: #00b7ff;
  border: 2px solid #ffffff;
  cursor: nwse-resize;
  display: none;
  box-sizing: border-box;
  pointer-events: auto;
}

.legend-block.selected .legend-resize-handle {
  display: block;
}

.legend-action-panel {
  margin-top: 10px;
}

.run-item-picker-modal {
  width: min(900px, calc(100vw - 32px));
  height: auto;
  overflow-y:auto;
}

.run-item-picker-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
   min-height: 0;
}

.run-item-picker-context {
  font-size: 13px;
  color: #cfcfcf;
}

.run-item-picker-search {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.run-item-picker-search input,
.run-item-picker-field input,
.run-item-picker-field select {
  height: 34px;
  border-radius: 6px;
  border: 1px solid #4a4a4a;
  background: #1b1b1b;
  color: #efefef;
  padding: 0 10px;
  box-sizing: border-box;
}

.run-item-picker-results {
  max-height: 200px;
  flex-shrink: 0;
  overflow: auto;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background: #1c1c1d;
}

.run-item-picker-row {
  width: 100%;
  border: none;
  border-bottom: 1px solid #2f2f2f;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.run-item-picker-row:last-child {
  border-bottom: none;
}

.run-item-picker-row:hover,
.run-item-picker-row.is-selected {
  background: #2a3558;
}

.run-item-picker-row-text {
  font-size: 12px;
  line-height: 1.35;
}

.run-item-picker-row-state {
  flex-shrink: 0;
  font-size: 11px;
  color: #c3d5ff;
}
.run-item-distance-field.is-disabled {
  opacity: 0.65;
}
.run-item-measure-btn {
  width: 100%;
  height: 34px;
}

.run-item-measure-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.run-measure-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10020;
}

.run-measure-card {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 320px;
  max-width: calc(100vw - 32px);
  background: rgba(24, 24, 26, 0.96);
  border: 1px solid #4a4a4a;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  padding: 12px 14px;
  color: #f0f0f0;
  box-sizing: border-box;
}

.run-measure-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}

.run-measure-copy,
.run-measure-meta,
.run-measure-hint {
  font-size: 12px;
  line-height: 1.4;
}

.run-measure-meta {
  color: #d5d9e0;
  margin-top: 4px;
}

.run-measure-hint {
  color: #9fa7b3;
  margin-top: 6px;
}


.device-explorer-runitem-row.selected td {
  background: #2a3558;
}

.device-explorer-runitem-row.selected:hover td {
  background: #314066;
}

.run-item-picker-empty {
  padding: 14px;
  color: #b8b8b8;
  font-size: 13px;
}

.run-item-picker-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.run-item-picker-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.run-item-picker-field--full {
  grid-column: 1 / -1;
}

.run-item-distance-field.is-disabled {
  opacity: 0.65;
}

.run-item-picker-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.device-row-tree-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.device-row-tree-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-items-toggle-btn,
.run-item-add-btn,
.device-explorer-runitem-remove-btn {
  height: 28px;
  border-radius: 6px;
  border: 1px solid #4a4a4a;
  background: #1f1f1f;
  color: #e6e6e6;
  cursor: pointer;
}

.run-items-toggle-btn {
  min-width: 30px;
  padding: 0 8px;
}

.run-items-toggle-btn.is-empty {
  cursor: default;
}

.run-item-add-btn,
.device-explorer-runitem-remove-btn {
  padding: 0 10px;
  white-space: nowrap;
}



.device-explorer-runitem-row:hover td {
  background: #243240;
}

.device-explorer-runitem-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d4deea;
  font-size: 12px;
}

.device-explorer-runitem-indent {
  color: #8bb4ff;
  font-weight: 700;
}

.device-explorer-runitem-input,
.device-explorer-runitem-select {
  width: 100%;
  min-width: 0;
  height: 30px;
  border-radius: 6px;
  border: 1px solid #4a4a4a;
  background: #161616;
  color: #f0f0f0;
  padding: 0 8px;
  box-sizing: border-box;
}

.device-explorer-runitem-input:disabled {
  opacity: 0.6;
}

.device-explorer-runitem-total {
  font-weight: 700;
  color: #f0f3f7;
}

.device-explorer-runitem-notes-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 980px) {
  .run-item-picker-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/*start photo gallery */
.device-explorer-photo-link {
  border: none;
  background: transparent;
  color: #7fb3ff;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font: inherit;
}

.device-explorer-photo-link:hover {
  color: #a9ccff;
}

.field-photo-gallery-modal {
  width: min(960px, 92vw);
  height: auto;
  max-height: 90vh;
}

#field-photo-gallery-modal {
  z-index: 2100;
}

.field-photo-gallery-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-photo-gallery-stage {
  min-height: 320px;
  max-height: 65vh;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background: #111111;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.field-photo-gallery-stage img {
  max-width: 100%;
  max-height: 65vh;
  object-fit: contain;
  display: block;
}

.field-photo-gallery-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  color: #cccccc;
}

.field-photo-gallery-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}


.global-field-photo-gallery-modal {
  width: min(1200px, 94vw);
  max-height: 90vh;
}

#global-field-photo-gallery-modal {
  z-index: 2000;
}


.global-field-photo-gallery-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.global-field-photo-gallery-toolbar {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

.global-field-photo-gallery-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #cccccc;
}

.global-field-photo-gallery-toolbar input {
  height: 32px;
  border-radius: 6px;
  border: 1px solid #4a4a4a;
  background: #1f1f1f;
  color: #e6e6e6;
  padding: 0 10px;
}

.global-field-photo-search-wrap {
  min-width: 240px;
  flex: 1 1 240px;
}

.global-field-photo-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  max-height: 62vh;
  overflow: auto;
}

.global-field-photo-gallery-empty {
  padding: 18px;
  border: 1px dashed #4a4a4a;
  border-radius: 8px;
  color: #b8b8b8;
  background: #202021;
}

.global-field-photo-thumb {
  border: 1px solid #3a3a3a;
  background: #1c1c1d;
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.global-field-photo-thumb:hover {
  background: #2a2a2a;
}

.global-field-photo-thumb img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

.global-field-photo-thumb-meta {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.global-field-photo-thumb-title {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-field-photo-thumb-subtitle {
  font-size: 11px;
  color: #b8b8b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}



/*end photo gallery */

.save-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #2a5fff;
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
}

.save-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.save-toast.hidden {
  display: none;
}

.status-manager-modal {
  max-height: 90vh;
  height: 720px;
  display: flex;
  flex-direction: column;
}


.status-manager-body {
  flex: 1;
  min-height: 0;
  display: flex;
}

.status-details-panel {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.status-details-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
}

.status-details-actions {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid #3a3a3a;
  background: #2a2a2a;
}

.status-manager-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.status-manager-total {
  font-size: 13px;
  color: #d5d9df;
  padding-top: 10px;
}

.status-manager-total strong.is-invalid {
  color: #ff8f8f;
}

.status-manager-total strong.is-valid {
  color: #98d89e;
}

.status-manager-total-hint {
  font-size: 12px;
  color: #97a0ab;
}

.status-phase-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 160px;
}

.status-phase-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 44px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background: #1f1f1f;
}

.status-phase-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.status-phase-field label {
  font-size: 12px;
  color: #bfc5cd;
}

.status-phase-field input {
  background: #161616;
  color: #e6e6e6;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  padding: 8px 10px;
  box-sizing: border-box;
}

.status-phase-remove {
  width: 44px;
  min-width: 44px;
  padding: 0;
  height: 38px;
}

.status-phase-actions {
  display: flex;
  justify-content: flex-start;
  padding-top: 4px;
}

.status-phase-empty {
  border: 1px dashed #4a4a4a;
  border-radius: 8px;
  padding: 14px;
  color: #9fa7b3;
  background: #202021;
  font-size: 13px;
}

.device-explorer-cell-select.status-select {
  min-width: 140px;
}
