/* Melsec Monitor Cyber-Industrial Dark Theme */
:root {
  --m-bg-dark: #070b14;
  --m-bg-card: #0d1527;
  --m-bg-card-hover: #131f38;
  --m-bg-input: #080d19;
  --m-border: #1e293b;
  --m-border-glow: #0284c7;
  --m-text-main: #f8fafc;
  --m-text-sub: #94a3b8;
  --m-text-muted: #64748b;
  --m-blue: #0ea5e9;
  --m-blue-light: #38bdf8;
  --m-green: #10b981;
  --m-green-glow: rgba(16, 185, 129, 0.25);
  --m-yellow: #f59e0b;
  --m-red: #ef4444;
  --m-purple: #8b5cf6;
  --melsec-tab-height: 800px;
}

.melsec-container {
  max-width: 1260px;
  width: min(100% - 32px, 1260px);
  margin: 0 auto;
  padding: 0 0 60px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--m-text-main);
  overscroll-behavior-y: auto;
}

/* Sleek Modern Dark Scrollbars for Melsec UI */
.melsec-container ::-webkit-scrollbar,
.m-table-responsive::-webkit-scrollbar,
.m-log-box::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
.melsec-container ::-webkit-scrollbar-track,
.m-table-responsive::-webkit-scrollbar-track,
.m-log-box::-webkit-scrollbar-track {
  background: #080d19;
}
.melsec-container ::-webkit-scrollbar-thumb,
.m-table-responsive::-webkit-scrollbar-thumb,
.m-log-box::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
}
.melsec-container ::-webkit-scrollbar-thumb:hover,
.m-table-responsive::-webkit-scrollbar-thumb:hover,
.m-log-box::-webkit-scrollbar-thumb:hover {
  background: #0284c7;
}
.melsec-container ::-webkit-scrollbar-button,
.m-table-responsive::-webkit-scrollbar-button,
.m-log-box::-webkit-scrollbar-button {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Eliminate dated/clunky native browser number spin buttons */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
  display: none !important;
}
input[type=number] {
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

/* Header & Status Bar */
.melsec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 16px;
  background: var(--m-bg-card);
  border: 1px solid var(--m-border);
  border-radius: 12px;
  padding: 14px 20px;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  min-height: 72px;
  box-sizing: border-box;
}

.melsec-branding {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1 1 auto;
}

.melsec-logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(14, 165, 233, 0.4);
  flex-shrink: 0;
}

.melsec-title-box {
  min-width: 0;
}

.melsec-title-box h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.melsec-title-box h1 span.tag-ver {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(14, 165, 233, 0.2);
  color: var(--m-blue-light);
  border: 1px solid rgba(14, 165, 233, 0.4);
  white-space: nowrap;
}

.melsec-title-box p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--m-text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.melsec-header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: auto;
  justify-content: flex-end;
}

/* Indicator Badges */
.m-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  border: 1px solid transparent;
  white-space: nowrap;
}

#bridge-status-badge {
  min-width: 142px;
  justify-content: center;
  box-sizing: border-box;
}

#plc-status-badge {
  min-width: 175px;
  justify-content: center;
  box-sizing: border-box;
}

.m-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.m-badge-offline {
  background: rgba(100, 116, 139, 0.15);
  color: var(--m-text-sub);
  border-color: rgba(100, 116, 139, 0.3);
}
.m-badge-offline .m-badge-dot {
  background: var(--m-text-muted);
}

.m-badge-online {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}
.m-badge-online .m-badge-dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.m-badge-sim {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}
.m-badge-sim .m-badge-dot {
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
}

.m-badge-fps {
  background: #091a13;
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-variant-numeric: tabular-nums;
  min-width: 126px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
}

#fps-counter-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: inline-block;
  min-width: 58px;
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* PC Bridge Download Button */
.btn-pc-bridge-download {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-pc-bridge-download:hover {
  background: linear-gradient(135deg, #0369a1, #1d4ed8);
  box-shadow: 0 0 16px rgba(14, 165, 233, 0.5);
  transform: translateY(-1px);
}

/* Clean Language Switcher Dropdown (Separated from drawer hamburger!) */
.lang-switcher-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--m-bg-input);
  border: 1px solid var(--m-border);
  border-radius: 8px;
  padding: 3px 8px;
}

.lang-switcher-wrap select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 4px center;
  color: var(--m-text-main);
  border: none;
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  padding: 2px 20px 2px 4px;
}

.lang-switcher-wrap select option {
  background: var(--m-bg-card);
  color: var(--m-text-main);
}

/* Navigation Tabs */
.melsec-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--m-border);
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.m-tab-btn {
  background: transparent;
  border: none;
  color: var(--m-text-sub);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  white-space: nowrap;
  position: relative;
}

.m-tab-btn:hover {
  color: var(--m-text-main);
  background: rgba(255, 255, 255, 0.04);
}

.m-tab-btn.active {
  color: var(--m-blue-light);
  background: var(--m-bg-card);
  border: 1px solid var(--m-border);
  border-bottom: 2px solid var(--m-blue);
  margin-bottom: -2px;
}

/* Tab Panels */
.m-tab-pane {
  display: none;
  margin-bottom: 36px;
  box-sizing: border-box;
  animation: fadeInTab 0.2s ease-in-out;
}
.m-tab-pane.active {
  display: block;
}

@keyframes fadeInTab {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Strict Equal Tab Heights Across All Tabs (Default 800px, User-Resizable for Web) */
@media (min-width: 993px) {
  /* All Tab Panes: Exact Uniform Height & Zero-Deviation Baseline for Web */
  body:not(.gogg-desktop-mode) .m-tab-pane {
    height: var(--melsec-tab-height, 800px) !important;
    min-height: 450px !important;
    max-height: var(--melsec-tab-height, 800px) !important;
    margin-bottom: 10px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  body:not(.gogg-desktop-mode) .m-tab-pane.active {
    display: flex !important;
    flex-direction: column !important;
  }

  /* 1. Connection Tab: Single unified outer panel enclosing 2 sub-panels */
  body:not(.gogg-desktop-mode) #tab-connection .connection-main-panel {
    flex: 1 1 0% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: var(--melsec-tab-height, 800px) !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    margin-bottom: 0 !important;
    padding: 20px !important;
    background: var(--m-bg-card);
    border: 1px solid var(--m-border);
    border-radius: 12px;
    overflow: hidden !important;
  }
  body:not(.gogg-desktop-mode) #tab-connection .connection-main-panel .m-grid-2 {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    align-items: stretch !important;
    gap: 20px !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
  }
  body:not(.gogg-desktop-mode) #tab-connection .connection-sub-panel {
    background: #080e1d;
    border: 1px solid #1e293b;
    border-radius: 10px;
    padding: 18px 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    flex: 1 1 0% !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
  }

  /* 2. Device Monitor Tab: Table Docks Fill with internal scroll */
  body:not(.gogg-desktop-mode) #tab-monitor .m-card {
    flex: 1 1 0% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: var(--melsec-tab-height, 800px) !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    margin-bottom: 0 !important;
    overflow: hidden !important;
  }
  body:not(.gogg-desktop-mode) #tab-monitor .m-card-header,
  body:not(.gogg-desktop-mode) #tab-monitor #monitor-sheet-tabs-bar {
    flex-shrink: 0 !important;
  }
  body:not(.gogg-desktop-mode) #tab-monitor #monitor-table-wrap {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: none !important;
    overflow: auto !important;
  }

  /* 3. Device Write Tab: Grid cards, Batch Queue table fills remaining space */
  body:not(.gogg-desktop-mode) #tab-write .m-grid-2 {
    flex: 1 1 0% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: var(--melsec-tab-height, 800px) !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 20px !important;
    align-items: stretch !important;
    box-sizing: border-box !important;
  }
  body:not(.gogg-desktop-mode) #tab-write .m-grid-2 > .m-card {
    flex: 1 1 0% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: var(--melsec-tab-height, 800px) !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    margin-bottom: 0 !important;
    overflow: hidden !important;
  }
  body:not(.gogg-desktop-mode) #tab-write .m-grid-2 > .m-card:first-child {
    overflow-y: auto !important;
  }
  body:not(.gogg-desktop-mode) #tab-write .m-grid-2 > .m-card:last-child .m-table-responsive {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: none !important;
    overflow-y: auto !important;
  }

  /* 4. Touch Panel HMI Tab: Canvas fills screen frame */
  body:not(.gogg-desktop-mode) #tab-hmi .hmi-container {
    flex: 1 1 0% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: var(--melsec-tab-height, 800px) !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    margin-bottom: 0 !important;
    overflow: hidden !important;
  }
  body:not(.gogg-desktop-mode) #tab-hmi .hmi-top-bar {
    flex-shrink: 0 !important;
  }
  body:not(.gogg-desktop-mode) #tab-hmi .hmi-screen-wrapper {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  body:not(.gogg-desktop-mode) #tab-hmi .hmi-canvas {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
  }
  body:not(.gogg-desktop-mode) #tab-hmi #hmi-sheet-tabs-bar {
    flex-shrink: 0 !important;
  }

  /* 5. Backup Analysis / Labels Tab: Dropzone & Explorer */
  body:not(.gogg-desktop-mode) #tab-labels .label-explorer-container {
    flex: 1 1 0% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: var(--melsec-tab-height, 800px) !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    margin-bottom: 0 !important;
    overflow: hidden !important;
  }
  #tab-labels .label-explorer-container > .m-card:first-child {
    min-height: auto !important;
    height: auto !important;
    margin-bottom: 12px !important;
    flex-shrink: 0 !important;
  }
  #tab-labels #labels-dropzone {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    margin-bottom: 0;
  }
  #tab-labels #labels-dropzone.hidden,
  #tab-labels #labels-dropzone[style*="display: none"],
  #tab-labels #labels-dropzone[style*="display:none"] {
    display: none !important;
  }
  #tab-labels #label-main-card {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    overflow: hidden;
  }
  #tab-labels #label-main-card.hidden,
  #tab-labels #label-main-card[style*="display: none"],
  #tab-labels #label-main-card[style*="display:none"] {
    display: none !important;
  }
  .label-subview-pane.hidden,
  #tab-labels #label-subview-watch.hidden,
  #tab-labels #label-subview-all.hidden {
    display: none !important;
  }
  .label-subview-pane.active,
  #tab-labels #label-subview-watch.active,
  #tab-labels #label-subview-all.active {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
  }
  #tab-labels #label-watch-grid-container,
  #tab-labels #labels-table-container {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  #tab-labels .label-table-wrap,
  #tab-labels #label-watch-table-wrap,
  #tab-labels .m-table-responsive {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: none !important;
    overflow: auto !important;
  }
  #tab-labels .label-pagination,
  #tab-labels #label-subtabs-nav,
  #tab-labels #label-watch-summary-bar {
    flex-shrink: 0 !important;
  }

  /* 6. SECS/GEM Tab: Grid cards */
  body:not(.gogg-desktop-mode) #tab-secsgem .m-grid-2 {
    flex: 1 1 0% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: var(--melsec-tab-height, 800px) !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 20px !important;
    align-items: stretch !important;
    box-sizing: border-box !important;
  }
  body:not(.gogg-desktop-mode) #tab-secsgem .m-grid-2 > .m-card {
    flex: 1 1 0% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: var(--melsec-tab-height, 800px) !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    margin-bottom: 0 !important;
    overflow-y: auto !important;
  }

  /* 7. System Logs Tab: Matching height */
  body:not(.gogg-desktop-mode) #tab-logs .m-card {
    flex: 1 1 0% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: var(--melsec-tab-height, 800px) !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    margin-bottom: 0 !important;
    overflow: hidden !important;
  }
  body:not(.gogg-desktop-mode) #tab-logs .m-card-header {
    flex-shrink: 0 !important;
  }
  body:not(.gogg-desktop-mode) #tab-logs #system-log-terminal {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: none !important;
    overflow-y: auto !important;
  }

  /* 8. Packet Log Tab */
  body:not(.gogg-desktop-mode) #tab-packets .m-card {
    flex: 1 1 0% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: var(--melsec-tab-height, 800px) !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    margin-bottom: 0 !important;
    overflow: hidden !important;
  }
  body:not(.gogg-desktop-mode) #tab-packets .m-card-header {
    flex-shrink: 0 !important;
  }
  body:not(.gogg-desktop-mode) #tab-packets .m-table-responsive {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: none !important;
    overflow: auto !important;
  }

  /* Interactive Tab Height Resizer Bar (Web Only) */
  body:not(.gogg-desktop-mode) .melsec-tab-resizer {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    margin-top: 4px;
    margin-bottom: 30px;
    cursor: ns-resize;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    transition: opacity 0.2s ease;
  }
  body:not(.gogg-desktop-mode) .melsec-tab-resizer:hover .melsec-resizer-line {
    background: rgba(56, 189, 248, 0.45);
  }
  body:not(.gogg-desktop-mode) .melsec-tab-resizer:hover .melsec-resizer-handle {
    border-color: #38bdf8;
    color: #38bdf8;
    background: #0f172a;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
  }
  body:not(.gogg-desktop-mode) .melsec-tab-resizer.is-dragging {
    cursor: ns-resize;
  }
  body:not(.gogg-desktop-mode) .melsec-tab-resizer.is-dragging .melsec-resizer-line {
    background: #38bdf8;
  }
  body:not(.gogg-desktop-mode) .melsec-tab-resizer.is-dragging .melsec-resizer-handle {
    border-color: #38bdf8;
    background: #0284c7;
    color: #ffffff;
    box-shadow: 0 0 14px rgba(56, 189, 248, 0.6);
  }
}

/* Common Resizer Elements */
.melsec-tab-resizer {
  display: none;
}
.melsec-resizer-line {
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.2s ease;
}
.melsec-resizer-handle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 14px;
  background: #090e17;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #94a3b8;
  cursor: ns-resize;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
body.melsec-resizing {
  cursor: ns-resize !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}
body.melsec-resizing * {
  cursor: ns-resize !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}
body.gogg-desktop-mode #melsec-tab-resizer,
body.gogg-desktop-mode .melsec-tab-resizer {
  display: none !important;
}

/* Grid & Cards */
.m-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Add Item Toolbar Grid (Desktop & Responsive) */
.mon-add-toolbar-grid {
  display: grid;
  grid-template-columns: minmax(240px, 3fr) minmax(130px, 1.4fr) 70px 180px 145px;
  gap: 10px;
  align-items: flex-end;
}

@media (max-width: 992px) {
  .m-tab-pane,
  .connection-main-panel,
  .hmi-container,
  .label-explorer-container,
  .monitor-main-card,
  #tab-monitor .m-card,
  #tab-logs .m-card,
  #tab-packets .m-card {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
  }
  .m-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 880px) {
  /* Prevent any horizontal screen drift across the entire page */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  .melsec-container {
    width: calc(100% - 16px) !important;
    padding: 10px 0 40px !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }
  .m-card {
    padding: 14px !important;
    margin-bottom: 14px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  .melsec-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    min-height: auto;
    overflow: hidden;
  }
  .melsec-branding {
    width: 100%;
    min-width: 0;
  }
  .melsec-title-box h1 {
    flex-wrap: wrap;
    white-space: normal;
    font-size: 1.15rem;
    gap: 6px;
  }
  .melsec-header-controls {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-left: 0;
    gap: 6px;
  }
  #bridge-status-badge,
  #plc-status-badge,
  .m-badge-fps {
    min-width: 0 !important;
    padding: 4px 10px;
    font-size: 11px;
  }
  #labels-dropzone {
    padding: 20px 12px !important;
  }
  #labels-dropzone > div:last-child {
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
  }
  .m-guide-section {
    padding: 18px 14px !important;
  }

  /* 1. Navigation Bar & Tabs on Mobile */
  .melsec-nav-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    margin-bottom: 14px !important;
  }
  .btn-pc-bridge-download {
    width: 100% !important;
    justify-content: center !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }
  #btn-gx3-project {
    width: 100% !important;
    justify-content: center !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }
  .melsec-nav-sep {
    display: none !important;
  }
  .melsec-tabs {
    width: 100% !important;
    flex: none !important;
    margin-top: 4px !important;
    margin-bottom: 8px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 4px !important;
  }
  .m-tab-btn {
    padding: 8px 14px !important;
    font-size: 12.5px !important;
    flex-shrink: 0 !important;
  }

  /* 2. Device Monitor Tab - Search & Action Bar on Mobile */
  .mon-filter-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 10px !important;
  }
  .mon-filter-toolbar > div:first-child {
    min-width: 0 !important;
    width: 100% !important;
    display: flex !important;
    gap: 8px !important;
  }
  .mon-filter-toolbar > div:first-child > div:first-child {
    flex: 1 1 0% !important;
    min-width: 0 !important;
  }
  .mon-filter-toolbar input#monitor-filter-text {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  .mon-filter-toolbar select#device-filter-select {
    flex: 0 0 auto !important;
    min-width: 75px !important;
    max-width: 110px !important;
  }
  .mon-filter-toolbar > div:last-child {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    justify-content: flex-start !important;
  }
  .mon-filter-toolbar > div:last-child .m-btn {
    flex: 1 1 auto !important;
    justify-content: center !important;
    min-width: 85px !important;
  }

  /* 3. Device Monitor Tab - Add Item Toolbar (Responsive 2-col Grid on Mobile) */
  .mon-add-toolbar-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }
  .mon-add-toolbar-grid > div:first-child {
    grid-column: 1 / -1 !important; /* Address input takes full row */
    width: 100% !important;
  }
  .mon-add-toolbar-grid > div:first-child input {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .mon-add-toolbar-grid > div:nth-child(2) {
    grid-column: 1 !important; /* Interval */
    width: 100% !important;
  }
  .mon-add-toolbar-grid > div:nth-child(2) input,
  .mon-add-toolbar-grid > div:nth-child(2) select {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .mon-add-toolbar-grid > div:nth-child(3) {
    grid-column: 2 !important; /* Count */
    width: 100% !important;
  }
  .mon-add-toolbar-grid > div:nth-child(3) input {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .mon-add-toolbar-grid > div:nth-child(4) {
    grid-column: 1 !important; /* Data Type */
    width: 100% !important;
  }
  .mon-add-toolbar-grid > div:nth-child(4) select {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .mon-add-toolbar-grid > div:nth-child(5) {
    grid-column: 2 !important; /* + Add button & Settings */
    width: 100% !important;
    display: flex !important;
    gap: 6px !important;
  }
  .mon-add-toolbar-grid > div:nth-child(5) button#btn-add-item {
    flex: 1 1 0% !important;
  }

  /* 4. Table Parent Panel Containment & Horizontal Scroll */
  .m-table-responsive {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
  }
  #monitor-table-wrap {
    min-height: 280px !important;
  }

  /* 5. HMI Tab - Mobile Top Bar & Canvas Containment */
  .hmi-top-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
  .hmi-top-bar > div:first-child {
    width: 100% !important;
    display: flex !important;
    justify-content: stretch !important;
  }
  .hmi-mode-toggle {
    width: 100% !important;
    display: flex !important;
  }
  .hmi-mode-toggle button {
    flex: 1 1 0% !important;
    justify-content: center !important;
  }
  .hmi-actions-group {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .hmi-actions-group .m-btn {
    flex: 1 1 calc(33.333% - 6px) !important;
    min-width: 80px !important;
    justify-content: center !important;
    padding: 6px 8px !important;
    font-size: 11.5px !important;
  }
  #btn-hmi-reset-demo {
    flex: 1 1 100% !important;
    margin-left: 0 !important;
    margin-top: 2px !important;
  }
  .hmi-screen-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  .hmi-canvas {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
    padding: 14px 10px !important;
    min-height: 480px !important;
  }
  .hmi-canvas-header {
    min-width: 480px !important;
  }
}

.m-card {
  background: var(--m-bg-card);
  border: 1px solid var(--m-border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.m-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--m-border);
  padding-bottom: 12px;
}

.m-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--m-text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Form Controls */
.m-form-group {
  margin-bottom: 14px;
}

.m-form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--m-text-sub);
  margin-bottom: 6px;
}

.m-input, .m-select {
  width: 100%;
  background: var(--m-bg-input);
  border: 1px solid var(--m-border);
  border-radius: 7px;
  padding: 8px 12px;
  color: var(--m-text-main);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.m-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

.m-select option {
  background: var(--m-bg-card);
  color: var(--m-text-main);
}

.m-input:focus, .m-select:focus {
  border-color: var(--m-blue);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.m-select:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.m-input-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.m-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--m-text-main);
}

.m-checkbox-label input[type="checkbox"] {
  accent-color: var(--m-blue);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Buttons */
.m-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.m-btn-primary {
  background: #0284c7;
  color: #ffffff;
}
.m-btn-primary:hover {
  background: #0369a1;
  box-shadow: 0 0 14px rgba(14, 165, 233, 0.4);
}

.m-btn-success {
  background: #059669;
  color: #ffffff;
}
.m-btn-success:hover {
  background: #047857;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.4);
}

.m-btn-danger {
  background: #dc2626;
  color: #ffffff;
}
.m-btn-danger:hover {
  background: #b91c1c;
}

.m-btn-secondary {
  background: #1e293b;
  color: var(--m-text-main);
  border-color: #334155;
}
.m-btn-secondary:hover {
  background: #334155;
}

.m-btn-sm {
  padding: 5px 10px;
  font-size: 11px;
}

/* Data Tables */
.m-table-responsive {
  overflow-x: auto;
}

.m-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.m-table th {
  background: #0a1120;
  color: var(--m-text-sub);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--m-border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.m-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-family: inherit;
}

.m-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.m-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.m-val-glow {
  font-weight: 700;
  color: #38bdf8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.m-alarm-high {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #f87171 !important;
}

.m-alarm-low {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #fbbf24 !important;
}

/* Drag and Drop Row Reordering */
.m-monitor-row {
  cursor: default;
  transition: background 0.1s ease;
}
.m-monitor-row:active {
  cursor: default;
}
.m-drag-cell {
  width: 36px;
  max-width: 44px;
  text-align: center;
  padding: 8px 4px !important;
  user-select: none;
  white-space: nowrap;
}
.m-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  color: #64748b;
  font-size: 15px;
  cursor: grab;
  user-select: none;
  transition: color 0.15s, background 0.15s;
}
.m-monitor-row:hover .m-drag-handle {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
}
.m-drag-handle:active {
  cursor: grabbing;
}
/* Custom Drag & Drop Live Reordering Styles */
tr.m-row-placeholder {
  background: rgba(14, 165, 233, 0.08) !important;
  outline: 2px dashed #0284c7 !important;
  outline-offset: -2px;
}
tr.m-row-placeholder td {
  opacity: 0.15 !important;
}

.m-drag-floating-clone {
  position: fixed !important;
  pointer-events: none !important;
  z-index: 99999 !important;
  background: #0b1329 !important;
  border: 1px solid #38bdf8 !important;
  border-radius: 6px !important;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.8), 0 0 16px rgba(56, 189, 248, 0.5) !important;
  opacity: 0.94 !important;
  transform: translateY(-50%);
  box-sizing: border-box !important;
  overflow: hidden !important;
}
.m-drag-floating-clone table {
  width: 100% !important;
  border-collapse: collapse !important;
  table-layout: fixed !important;
}
.m-drag-floating-clone td {
  padding: 8px 10px !important;
  font-size: 13px !important;
  color: #f8fafc !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
}

/* Inline Description Editing */
.m-desc-cell {
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease;
}
.m-desc-cell:hover .m-desc-display {
  background: rgba(56, 189, 248, 0.08);
  outline: 1px dashed rgba(56, 189, 248, 0.4);
  color: #e2e8f0;
}
.m-desc-inline-input:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

/* Terminal / Log Box */
.m-terminal {
  background: #050811;
  border: 1px solid var(--m-border);
  border-radius: 8px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  height: 380px;
  min-height: 380px;
  max-height: 380px;
  overflow-y: auto;
  overscroll-behavior: contain;
  line-height: 1.6;
}

.m-log-line {
  display: flex;
  gap: 10px;
  padding: 2px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.m-log-time {
  color: var(--m-text-muted);
  white-space: nowrap;
}

.m-log-tx { color: #38bdf8; }
.m-log-rx { color: #34d399; }
.m-log-err { color: #f87171; }
.m-log-warn { color: #fbbf24; }
.m-log-info { color: #94a3b8; }

/* Modal */
.m-modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.m-modal-backdrop.open,
.m-modal-backdrop.active {
  display: flex;
}

.m-modal-content {
  background: var(--m-bg-card);
  border: 1px solid var(--m-border-glow);
  border-radius: 12px;
  padding: 24px;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

/* Guide & Documentation Sections */
.m-guide-section {
  background: var(--m-bg-card);
  border: 1px solid var(--m-border);
  border-radius: 12px;
  padding: 24px;
  margin-top: 30px;
  line-height: 1.7;
}

.m-guide-section h2 {
  font-size: 20px;
  color: var(--m-blue-light);
  margin-top: 0;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.m-guide-section h3 {
  font-size: 16px;
  color: var(--m-text-main);
  margin-top: 20px;
  margin-bottom: 8px;
}

.m-guide-section p, .m-guide-section li {
  font-size: 14px;
  color: var(--m-text-sub);
}

.m-guide-section code {
  background: #090e1c;
  color: #38bdf8;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.m-guide-section pre {
  background: #050811;
  border: 1px solid var(--m-border);
  border-radius: 8px;
  padding: 14px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: #e2e8f0;
}

/* WPF DataGrid-style MC 3E Packet Log */
.m-packet-grid-container {
  height: 380px;
  min-height: 380px;
  max-height: 380px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #1e293b;
  border-radius: 8px;
  background: #090e1c;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

.m-packet-grid {
  width: 100%;
  border-collapse: collapse;
  font-family: inherit;
  font-size: 11.5px;
  white-space: nowrap;
}

.m-packet-grid thead th {
  background: #0b1329;
  color: #38bdf8;
  font-weight: 700;
  border-bottom: 2px solid #1e293b;
  position: sticky;
  top: 0;
  z-index: 5;
  user-select: none;
  padding: 8px 10px;
}

.m-packet-grid tbody tr {
  border-bottom: 1px solid rgba(30, 41, 59, 0.6);
  transition: background 0.1s ease;
}

.m-packet-grid tbody tr:hover {
  background: rgba(56, 189, 248, 0.06);
}

.m-packet-grid td {
  padding: 5px 10px;
  vertical-align: middle;
}

.m-pkt-col-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #94a3b8;
  font-size: 11px;
}

.m-pkt-badge {
  display: inline-block;
  padding: 1px 7px;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 4px;
  text-align: center;
  line-height: 1.4;
  letter-spacing: 0.5px;
}

.m-pkt-tx {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.m-pkt-rx {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.4);
}

.m-pkt-err {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.4);
}

.m-pkt-link {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(192, 132, 252, 0.4);
}

.m-pkt-col-cmd {
  font-weight: 700;
  color: #f1f5f9;
}

.m-pkt-col-target {
  color: #38bdf8;
  font-family: inherit;
  font-weight: 500;
}

.m-pkt-col-size {
  color: #94a3b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
}

.m-pkt-col-elapsed {
  color: #4ade80;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 600;
  font-size: 11px;
}

.m-pkt-status-ok {
  color: #22c55e;
  font-weight: 600;
}

.m-pkt-status-err {
  color: #ef4444;
  font-weight: 700;
}

.m-pkt-col-hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #cbd5e1;
  font-size: 11px;
}

.m-pkt-hex-text {
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  transition: all 0.15s;
}

.m-pkt-hex-text:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
}

/* ====================================================
   Interactive HMI Touch Panel Styles
   ==================================================== */

.hmi-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hmi-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 8px 14px;
}

.hmi-pages-nav-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hmi-pages-list {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.hmi-page-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
  background: #1e293b;
  border: 1px solid #334155;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.hmi-page-tab:hover {
  color: #f8fafc;
  background: #334155;
}

.hmi-page-tab.active {
  color: #38bdf8;
  background: rgba(14, 165, 233, 0.15);
  border-color: #0ea5e9;
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.2);
}

.hmi-actions-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Run vs Edit Mode Segmented Control */
.hmi-mode-toggle {
  display: inline-flex;
  background: #090e1a;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.hmi-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.hmi-mode-btn:hover {
  color: #cbd5e1;
}

.hmi-mode-btn.active[data-mode="run"] {
  color: #22c55e;
  background: rgba(34, 197, 94, 0.15);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.2);
}

.hmi-mode-btn.active[data-mode="edit"] {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.2);
}

.hmi-mode-btn.active[data-mode="simul"] {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.2);
}

/* Canvas Screen */
.hmi-canvas {
  background: radial-gradient(#1e293b 1.2px, transparent 1.2px), #070d19;
  background-size: 20px 20px;
  border: 2px solid #1e293b;
  border-radius: 12px;
  min-height: 540px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6);
  position: relative;
}

.hmi-canvas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.hmi-canvas-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hmi-screen-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  animation: hmiPulseDot 2s infinite ease-in-out;
}

@keyframes hmiPulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.hmi-edit-badge {
  font-size: 11px;
  font-weight: 700;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: 0.5px;
}

/* Widgets Freeform Canvas */
.hmi-widgets-grid {
  position: relative;
  width: 100%;
  min-height: 560px;
  margin-top: 10px;
  box-sizing: border-box;
}

/* Empty State */
.hmi-empty-state {
  margin: auto;
  text-align: center;
  padding: 60px 20px;
}

/* Widget Card Frame */
.hmi-widget-card {
  position: absolute;
  box-sizing: border-box;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  user-select: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
  container-type: size;
  overflow: hidden;
}

/* Button & Word Switch Widget: Compact, Borderless Container */
.hmi-widget-card.hmi-type-button,
.hmi-widget-card.hmi-type-word_switch {
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}

.hmi-widget-card.hmi-type-button .hmi-btn-wrap,
.hmi-widget-card.hmi-type-word_switch .hmi-btn-wrap {
  width: 100%;
  height: 100%;
}

.hmi-widget-card.hmi-type-button .hmi-touch-btn,
.hmi-widget-card.hmi-type-word_switch .hmi-touch-btn {
  width: 100%;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
}

/* Canvas in Edit Mode */
.hmi-canvas.is-edit-mode .hmi-widget-card {
  cursor: grab;
  overflow: visible !important;
}

.hmi-canvas.is-edit-mode .hmi-widget-card:hover {
  border-color: #38bdf8;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.3);
}

.hmi-canvas.is-edit-mode .hmi-widget-card.hmi-type-button,
.hmi-canvas.is-edit-mode .hmi-widget-card.hmi-type-word_switch {
  outline: 1px dashed rgba(56, 189, 248, 0.5);
  outline-offset: 1px;
  border-radius: 8px;
}

.hmi-canvas.is-edit-mode .hmi-widget-card.is-dragging {
  cursor: grabbing !important;
  z-index: 1000 !important;
  opacity: 0.92;
  outline: 2px solid #38bdf8 !important;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.8), 0 0 20px rgba(56, 189, 248, 0.6) !important;
}

.hmi-canvas.is-edit-mode .hmi-widget-card.is-resizing {
  z-index: 1000 !important;
  outline: 2px solid #a855f7 !important;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.7), 0 0 16px rgba(168, 85, 247, 0.5) !important;
}

/* Edit Bar on Each Card */
.hmi-card-edit-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 16, 31, 0.96);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 6px;
  padding: 2px 6px;
  margin-bottom: 4px;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  box-sizing: border-box;
  max-width: 100%;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

.hmi-edit-bar-btns {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  flex-shrink: 0;
}

.hmi-canvas.is-edit-mode .hmi-card-edit-bar {
  display: flex;
}

.hmi-canvas.is-edit-mode .hmi-widget-card.hmi-type-button .hmi-card-edit-bar,
.hmi-canvas.is-edit-mode .hmi-widget-card.hmi-type-word_switch .hmi-card-edit-bar {
  position: absolute;
  top: -28px;
  left: 0;
  right: 0;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0;
  z-index: 20;
}

.hmi-canvas.is-edit-mode .hmi-widget-card.selected {
  outline: 2px solid #38bdf8 !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.55), 0 12px 24px rgba(0, 0, 0, 0.6) !important;
  z-index: 60 !important;
}

.hmi-canvas.is-edit-mode .hmi-widget-card.selected .hmi-card-edit-bar {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5) !important;
}

.hmi-selection-box {
  position: absolute;
  border: 2px solid #38bdf8 !important;
  background: rgba(56, 189, 248, 0.22) !important;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.6), inset 0 0 16px rgba(56, 189, 248, 0.35) !important;
  border-radius: 4px;
  pointer-events: none;
  z-index: 9999 !important;
  box-sizing: border-box;
}

.hmi-sel-pill {
  position: absolute;
  bottom: -28px;
  right: 0;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
  color: #38bdf8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  letter-spacing: 0.5px;
}

.hmi-drag-grip {
  font-size: 13px;
  color: #64748b;
  cursor: grab;
  padding: 0 2px;
}

.hmi-drag-grip:hover {
  color: #38bdf8;
}

.hmi-card-header-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.hmi-widget-title-text {
  font-size: 12px;
  font-size: clamp(11px, min(7cqw, 14cqh), 22px);
  font-weight: 700;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1 1 auto;
}

.hmi-widget-dev-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: inline-block;
  line-height: 1.3;
}

.hmi-edit-tool-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  border-radius: 4px;
  font-size: 11px;
  padding: 2px 5px;
  cursor: pointer;
  transition: all 0.15s;
}

.hmi-edit-tool-btn:hover {
  color: #f8fafc;
  background: #334155;
}

.hmi-edit-tool-btn.danger:hover {
  color: #f87171;
  background: #450a0a;
  border-color: #dc2626;
}

/* Corner Resize Handle */
.hmi-resize-handle {
  display: none;
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  z-index: 30;
  user-select: none;
  touch-action: none;
}

.hmi-canvas.is-edit-mode .hmi-resize-handle {
  display: block;
}

.hmi-resize-handle::after {
  content: '';
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 8px;
  height: 8px;
  border-right: 2px solid #38bdf8;
  border-bottom: 2px solid #38bdf8;
  border-radius: 1px;
  transition: all 0.15s;
}

.hmi-resize-handle:hover::after {
  border-color: #ffffff;
  width: 10px;
  height: 10px;
}

/* Widget: Push Button & Word Switch */
.hmi-btn-wrap {
  width: 100%;
  height: 100%;
  display: flex;
}

.hmi-touch-btn {
  width: 100%;
  height: 100%;
  min-height: 48px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  gap: clamp(2px, 3cqh, 8px);
  cursor: pointer;
  user-select: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4), 0 6px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  padding: 8px 12px;
  padding: clamp(6px, 6cqh, 20px) clamp(8px, 6cqw, 24px);
}

.hmi-touch-btn:active, .hmi-touch-btn.hmi-btn-pressed {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hmi-touch-btn.hmi-btn-active-state {
  border-color: #fff;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.2);
}

/* Button Color Variations */
.hmi-touch-btn.hmi-btn-blue {
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
}
.hmi-touch-btn.hmi-btn-green {
  background: linear-gradient(180deg, #10b981 0%, #047857 100%);
  color: #ffffff;
}
.hmi-touch-btn.hmi-btn-red {
  background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
  color: #ffffff;
}
.hmi-touch-btn.hmi-btn-amber {
  background: linear-gradient(180deg, #f59e0b 0%, #b45309 100%);
  color: #ffffff;
}
.hmi-touch-btn.hmi-btn-purple {
  background: linear-gradient(180deg, #8b5cf6 0%, #6d28d9 100%);
  color: #ffffff;
}
.hmi-touch-btn.hmi-btn-gray {
  background: linear-gradient(180deg, #475569 0%, #334155 100%);
  color: #ffffff;
}

.hmi-btn-main-label {
  font-size: 14px;
  font-size: clamp(12px, min(13cqw, 24cqh), 48px);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
}

.hmi-btn-subtext {
  font-size: 11px;
  font-size: clamp(10px, min(8cqw, 14cqh), 22px);
  opacity: 0.85;
  font-weight: 500;
}

.hmi-btn-indicator-dot {
  position: absolute;
  top: 7px;
  right: 8px;
  top: clamp(5px, 8cqh, 16px);
  right: clamp(6px, 8cqw, 18px);
  width: 8px;
  height: 8px;
  width: clamp(7px, min(6cqw, 12cqh), 18px);
  height: clamp(7px, min(6cqw, 12cqh), 18px);
  border-radius: 50%;
  background: #334155;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.2s;
}

.hmi-btn-indicator-dot.on {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
  border-color: #86efac;
}

/* Widget: Status Lamp */
.hmi-lamp-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 0;
  gap: 8px;
  gap: clamp(4px, 4cqh, 14px);
}

.hmi-lamp-label-block {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hmi-lamp-title {
  font-size: 12px;
  font-size: clamp(11px, min(9cqw, 14cqh), 26px);
  font-weight: 700;
  color: #cbd5e1;
  word-break: break-word;
}

.hmi-lamp-bezel {
  width: 60px;
  height: 60px;
  width: clamp(38px, min(48cqw, 52cqh), 220px);
  height: clamp(38px, min(48cqw, 52cqh), 220px);
  border-radius: 50%;
  background: linear-gradient(145deg, #334155, #0f172a);
  border: 2px solid #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5), inset 0 2px 3px rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.hmi-lamp-lens {
  width: 44px;
  height: 44px;
  width: 73%;
  height: 73%;
  border-radius: 50%;
  background: #0f172a;
  border: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.hmi-lamp-lens::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 8px;
  width: 40%;
  height: 22%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(-30deg);
  pointer-events: none;
}

/* Lamp On States */
.hmi-lamp-lens.on.lamp-green {
  background: radial-gradient(circle, #86efac 10%, #22c55e 50%, #15803d 100%);
  box-shadow: 0 0 24px #22c55e, inset 0 0 10px #ffffff;
  border-color: #86efac;
}
.hmi-lamp-lens.on.lamp-red {
  background: radial-gradient(circle, #fca5a5 10%, #ef4444 50%, #b91c1c 100%);
  box-shadow: 0 0 24px #ef4444, inset 0 0 10px #ffffff;
  border-color: #fca5a5;
}
.hmi-lamp-lens.on.lamp-amber {
  background: radial-gradient(circle, #fde047 10%, #eab308 50%, #a16207 100%);
  box-shadow: 0 0 24px #eab308, inset 0 0 10px #ffffff;
  border-color: #fde047;
}
.hmi-lamp-lens.on.lamp-blue {
  background: radial-gradient(circle, #7dd3fc 10%, #0ea5e9 50%, #0369a1 100%);
  box-shadow: 0 0 24px #0ea5e9, inset 0 0 10px #ffffff;
  border-color: #7dd3fc;
}
.hmi-lamp-lens.on.lamp-purple {
  background: radial-gradient(circle, #d8b4fe 10%, #a855f7 50%, #6b21a8 100%);
  box-shadow: 0 0 24px #a855f7, inset 0 0 10px #ffffff;
  border-color: #d8b4fe;
}
.hmi-lamp-lens.on.lamp-cyan {
  background: radial-gradient(circle, #67e8f9 10%, #06b6d4 50%, #0e7490 100%);
  box-shadow: 0 0 24px #06b6d4, inset 0 0 10px #ffffff;
  border-color: #67e8f9;
}

.hmi-lamp-status-text {
  font-size: 12px;
  font-size: clamp(10px, min(8cqw, 13cqh), 22px);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.hmi-compare-val-badge {
  font-size: 11px;
  font-family: var(--font-mono, monospace);
  font-weight: 600;
  color: #64748b;
  margin-top: 2px;
  text-align: center;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

/* Widget: Bar Gauge */
.hmi-widget-card.hmi-type-gauge .hmi-gauge-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 6px 10px;
  box-sizing: border-box;
}
.hmi-gauge-track {
  width: 100%;
  height: 22px;
  background: #090e17;
  border: 1px solid #1e293b;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.8);
}
.hmi-gauge-fill {
  height: 100%;
  width: 0%;
  transition: width 0.12s ease-out;
  border-radius: 3px;
}
.hmi-gauge-fill.gauge-blue {
  background: linear-gradient(90deg, #0284c7 0%, #38bdf8 100%);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}
.hmi-gauge-fill.gauge-green {
  background: linear-gradient(90deg, #059669 0%, #34d399 100%);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.4);
}
.hmi-gauge-fill.gauge-amber {
  background: linear-gradient(90deg, #d97706 0%, #fbbf24 100%);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
}
.hmi-gauge-fill.gauge-red {
  background: linear-gradient(90deg, #dc2626 0%, #f87171 100%);
  box-shadow: 0 0 10px rgba(248, 113, 113, 0.4);
}
.hmi-gauge-scale {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-family: var(--font-mono, monospace);
  color: #64748b;
  padding: 0 2px;
}

/* Widget: Numeric / String Display */
.hmi-widget-card.hmi-type-display .hmi-display-box {
  flex: 1;
  min-height: 0;
  background: #050b14;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 8px 12px;
  padding: clamp(4px, 4cqh, 16px) clamp(8px, 5cqw, 20px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.8);
  box-sizing: border-box;
}

.hmi-mode-run .hmi-widget-card.hmi-type-display .hmi-display-box,
.hmi-mode-run .hmi-widget-card.hmi-type-display .hmi-card-header-compact {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.hmi-mode-run .hmi-widget-card.hmi-type-display .hmi-display-box:hover {
  border-color: #38bdf8 !important;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.8), 0 0 10px rgba(56, 189, 248, 0.3) !important;
}

.hmi-mode-run .hmi-widget-card.hmi-type-display .hmi-display-box.hmi-box-editing {
  border-color: #38bdf8 !important;
  background: rgba(11, 19, 43, 0.95) !important;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.8), 0 0 16px rgba(56, 189, 248, 0.65) !important;
  padding: clamp(2px, 2cqh, 8px) clamp(4px, 3cqw, 10px) !important;
  animation: hmiEditGlowPulse 2.2s infinite ease-in-out;
}

@keyframes hmiEditGlowPulse {
  0%, 100% {
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.8), 0 0 14px rgba(56, 189, 248, 0.45);
    border-color: #38bdf8;
  }
  50% {
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.8), 0 0 20px rgba(56, 189, 248, 0.85);
    border-color: #7dd3fc;
  }
}

.hmi-inline-edit-input {
  width: 100%;
  height: 100%;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  font-size: 22px;
  font-size: clamp(16px, min(16cqw, 48cqh), 72px) !important;
  font-weight: 700 !important;
  color: #38bdf8 !important;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.6) !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
  caret-color: #38bdf8 !important;
  text-align: right !important;
}

.hmi-inline-edit-input::selection {
  background: rgba(56, 189, 248, 0.4) !important;
  color: #ffffff !important;
}

.hmi-inline-enter-pill {
  transition: all 0.15s ease;
}

.hmi-display-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 22px;
  font-size: clamp(16px, min(16cqw, 48cqh), 72px);
  font-weight: 700;
  color: #38bdf8;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.hmi-display-unit {
  font-size: 12px;
  font-size: clamp(11px, min(8cqw, 20cqh), 28px);
  font-weight: 600;
  color: #94a3b8;
}

/* Widget: Value Input */
.hmi-widget-card.hmi-type-input .hmi-input-wrap {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.hmi-input-field {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
  background: #090e1a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 6px 10px;
  padding: clamp(4px, 4cqh, 12px) clamp(6px, 4cqw, 16px);
  color: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  font-size: clamp(12px, min(8cqw, 24cqh), 28px);
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.hmi-input-field:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.2);
}

.hmi-input-set-btn {
  flex-shrink: 0;
  white-space: nowrap;
  box-sizing: border-box;
  border-radius: 6px;
  padding: 6px 12px;
  padding: clamp(4px, 4cqh, 12px) clamp(8px, 6cqw, 20px);
  font-weight: 700;
  font-size: 12px;
  font-size: clamp(11px, min(7cqw, 22cqh), 24px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Widget: Slider */
.hmi-widget-card.hmi-type-slider .hmi-slider-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.hmi-slider-bar {
  width: 100%;
  height: clamp(6px, 10cqh, 16px);
  accent-color: #0ea5e9;
  cursor: pointer;
}

/* GX Works3 (.gx3) Project & Tag Picker Styles */
.gx3-dropzone {
  border: 2px dashed #0284c7;
  border-radius: 10px;
  background: rgba(2, 132, 199, 0.05);
  padding: 26px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 12px;
}
.gx3-dropzone:hover, .gx3-dropzone.dragover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  transform: scale(1.008);
}
.gx3-dropzone .gx3-drop-icon {
  font-size: 34px;
  margin-bottom: 8px;
  line-height: 1;
}
.gx3-dropzone .gx3-drop-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 4px;
}
.gx3-dropzone .gx3-drop-sub {
  font-size: 11.5px;
  color: #94a3b8;
}

/* Slim mode when file is loaded */
.gx3-dropzone.slim {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 10px;
  background: rgba(2, 132, 199, 0.03);
}
.gx3-dropzone.slim:hover, .gx3-dropzone.slim.dragover {
  transform: scale(1.004);
}
.gx3-dropzone.slim .gx3-drop-icon {
  font-size: 18px;
  margin-bottom: 2px;
  line-height: 1;
}
.gx3-dropzone.slim .gx3-drop-title {
  font-size: 12.5px;
  margin-bottom: 1px;
}
.gx3-dropzone.slim .gx3-drop-sub {
  font-size: 10.5px;
}
.gx3-progress-track {
  height: 12px;
  background: #090e1a;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #1e293b;
  position: relative;
}
.gx3-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0284c7, #38bdf8, #10b981);
  border-radius: 6px;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
  transition: width 35ms linear;
}
.gx3-tag-table-wrap {
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid #1e293b;
  border-radius: 8px;
  background: #090e1a;
}
.gx3-tag-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.gx3-tag-table th {
  position: sticky;
  top: 0;
  background: #0f172a;
  color: #94a3b8;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #334155;
  font-weight: 600;
  z-index: 2;
}
.gx3-tag-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #1e293b;
  color: #e2e8f0;
}
.gx3-tag-table tr:hover td {
  background: rgba(56, 189, 248, 0.08);
}
.gx3-badge-type {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background: #1e293b;
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}
.gx3-badge-dev {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-family: monospace;
  font-weight: 700;
  background: #064e3b;
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.4);
}

/* Visual Studio Style GX Works3 Label IntelliSense Popup */
.gx3-vs-intellisense {
  position: fixed;
  z-index: 100050;
  background: #1e1e1e;
  border: 1px solid #007acc;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85), 0 0 14px rgba(0, 122, 204, 0.45);
  max-height: 340px;
  width: 460px;
  min-width: 380px;
  max-width: 680px;
  display: none;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
  font-size: 13px;
  color: #d4d4d4;
  overflow: hidden;
  user-select: none;
}

.vs-intelli-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  background: #252526;
  border-bottom: 1px solid #333333;
  font-size: 11px;
  color: #9cdcfe;
  flex-shrink: 0;
}

.vs-intelli-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.vs-badge-count {
  background: #007acc;
  color: #ffffff;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
}

.vs-intelli-hints {
  font-size: 10px;
  color: #858585;
}

.vs-intelli-hints kbd {
  background: #333333;
  color: #cccccc;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid #444444;
  font-family: monospace;
}

.vs-intelli-list {
  list-style: none;
  margin: 0;
  padding: 2px 0;
  overflow-y: auto;
  flex: 1;
  max-height: 240px;
  background: #1e1e1e;
}

.vs-intelli-list::-webkit-scrollbar {
  width: 8px;
}
.vs-intelli-list::-webkit-scrollbar-track {
  background: #1e1e1e;
}
.vs-intelli-list::-webkit-scrollbar-thumb {
  background: #3e3e42;
  border-radius: 4px;
}
.vs-intelli-list::-webkit-scrollbar-thumb:hover {
  background: #555558;
}

.vs-intelli-item {
  display: flex;
  align-items: center;
  padding: 4px 10px;
  cursor: pointer;
  gap: 8px;
  height: 28px;
  box-sizing: border-box;
  transition: background 0.05s ease;
}

.vs-intelli-item:hover,
.vs-intelli-item.active {
  background: #007acc !important;
  color: #ffffff !important;
}

.vs-intelli-item.active .vs-sym-icon,
.vs-intelli-item.active .vs-item-name,
.vs-intelli-item.active .vs-item-dev,
.vs-intelli-item.active .vs-item-type,
.vs-intelli-item.active .match-hl {
  color: #ffffff !important;
}

.vs-sym-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.vs-sym-icon.struct { color: #4ec9b0; }
.vs-sym-icon.bit { color: #4ade80; }
.vs-sym-icon.word { color: #f59e0b; }
.vs-sym-icon.float { color: #c084fc; }
.vs-sym-icon.const { color: #38bdf8; }
.vs-sym-icon.module { color: #94a3b8; }

.vs-item-name {
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 12px;
  color: #d4d4d4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.vs-item-name .match-hl {
  color: #ffe066;
  font-weight: 700;
  text-decoration: underline;
}

.vs-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 11px;
}

.vs-item-dev {
  font-family: monospace;
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
}

.vs-item-type {
  font-size: 10px;
  color: #9cdcfe;
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.3);
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
}

.vs-intelli-footer {
  padding: 5px 12px;
  background: #252526;
  border-top: 1px solid #333333;
  font-size: 11px;
  color: #cccccc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  font-family: "Cascadia Code", Consolas, monospace;
}

.m-input.input-error,
input.input-error,
select.input-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25) !important;
  background-color: rgba(239, 68, 68, 0.08) !important;
  color: #fca5a5 !important;
}

/* Bottom Watch Sheet Tabs Bar & Item Tabs (Device Monitor & Backup Data Label Explorer) */
#monitor-sheet-tabs-bar,
#label-subtabs-nav {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  background: #070c18;
  border-left: 1px solid #1e293b;
  border-right: 1px solid #1e293b;
  border-bottom: 1px solid #1e293b;
  border-top: none !important;
  border-radius: 0 0 8px 8px;
  margin-top: 0 !important;
  padding: 0 12px;
  height: 38px;
  font-size: 12px;
  position: relative;
  box-sizing: border-box;
  flex-shrink: 0;
}

/* Background divider line for inactive tabs and empty bar spaces */
#monitor-sheet-tabs-bar::before,
#label-subtabs-nav::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: #1e293b;
  z-index: 1;
}

#monitor-page-tabs-container,
#label-page-tabs-container {
  display: flex;
  align-items: stretch;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden !important;
  max-width: 82%;
  height: 100%;
  position: relative;
  z-index: 2;
}
#monitor-page-tabs-container::-webkit-scrollbar,
#label-page-tabs-container::-webkit-scrollbar {
  height: 3px;
}
#monitor-page-tabs-container::-webkit-scrollbar:vertical,
#label-page-tabs-container::-webkit-scrollbar:vertical {
  display: none !important;
  width: 0 !important;
}
#monitor-page-tabs-container::-webkit-scrollbar-thumb,
#label-page-tabs-container::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 2px;
}

/* Inverted Tab: Flat on top (connected to monitor window), rounded at bottom */
.m-sheet-tab {
  height: 37px !important;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  transition: all 0.15s ease;
  box-sizing: border-box;
  /* Inverted shape: top 0 0, bottom 6px 6px */
  border-radius: 0 0 6px 6px !important;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  position: relative;
  top: 0;
  flex-shrink: 0;
  z-index: 2;
}

.m-sheet-tab:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #f8fafc;
}

/* Active Watch Tab: Seamlessly joined with the monitor table above (#0a1120) by masking top line completely */
.m-sheet-tab.active {
  background: #0a1120 !important;
  color: #38bdf8 !important;
  font-weight: 700;
  border-left: 1px solid #1e293b !important;
  border-right: 1px solid #1e293b !important;
  border-bottom: 1px solid #1e293b !important;
  border-top: none !important;
  border-radius: 0 0 6px 6px !important;
  box-shadow: none !important;
  position: relative;
  top: -1px !important;
  height: 39px !important;
  z-index: 10 !important;
}

.m-sheet-tab-badge {
  font-size: 10px;
  font-weight: bold;
  padding: 1px 6px;
  border-radius: 10px;
  transition: all 0.15s ease;
}
.m-sheet-tab.active .m-sheet-tab-badge {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
}
.m-sheet-tab:not(.active) .m-sheet-tab-badge {
  color: #64748b;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.m-sheet-tab-del {
  font-size: 13px;
  font-weight: bold;
  color: #64748b;
  padding: 0 2px;
  line-height: 1;
  cursor: pointer;
  margin-left: 2px;
  transition: color 0.15s;
}
.m-sheet-tab-del:hover {
  color: #f87171 !important;
}

.m-sheet-tab-add-btn {
  font-size: 12px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  border: 1px solid #1e293b;
  color: #38bdf8;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
  margin-top: 5px;
}
.m-sheet-tab-add-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
}

/* Array Dimension Selector Tabs in Add Item Toolbar */
.dim-tab-btn {
  background: #0f172a;
  border: 1px solid #334155;
  color: #94a3b8;
  font-family: Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  height: 34px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  user-select: none;
}
.dim-tab-btn:hover {
  background: #1e293b;
  color: #f8fafc;
  border-color: #475569;
}
.dim-tab-btn.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: #38bdf8;
  color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.25);
}

/* Array Dimension Dropdown with prominent Chevron Icon */
#mon-label-dim-select {
  background-color: #0f172a !important;
  border: 1px solid #38bdf8 !important;
  color: #38bdf8 !important;
  font-family: Consolas, monospace !important;
  font-size: 12px !important;
  font-weight: bold !important;
  border-radius: 7px !important;
  padding: 6px 28px 6px 8px !important;
  width: 100% !important;
  height: 34px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 8px center !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  cursor: pointer !important;
  box-sizing: border-box !important;
}
#mon-label-dim-select:focus {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25) !important;
}
#mon-label-dim-select option {
  background: #0b1329 !important;
  color: #f8fafc !important;
  font-family: Consolas, monospace !important;
}

/* Watchlist Column Visibility Controls */
.table-hide-update .col-update { display: none !important; }
.table-hide-address .col-address { display: none !important; }
.table-hide-type .col-type { display: none !important; }
.table-hide-comment .col-comment { display: none !important; }
.table-hide-desc .col-desc { display: none !important; }
#monitor-table-wrap .m-table th.col-device-label, #monitor-table-wrap .m-table td.col-device-label { width: 100%; min-width: 200px; max-width: 0; white-space: nowrap !important; overflow: hidden; text-overflow: ellipsis; box-sizing: border-box; }
#monitor-table-wrap .m-table th.col-desc, #monitor-table-wrap .m-table td.col-desc { width: 220px; min-width: 185px; max-width: 220px; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; box-sizing: border-box; }
#monitor-table-wrap .m-table td.col-desc .m-desc-display { display: block !important; width: 100%; max-width: 100%; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; box-sizing: border-box; }
#monitor-table-wrap .m-table th[data-loc="Col_Value"], #monitor-table-wrap .m-table td.m-val-cell { width: 135px; min-width: 125px; max-width: 150px; box-sizing: border-box; }
#monitor-table-wrap .m-table th.col-update, #monitor-table-wrap .m-table td.col-update { width: 90px; min-width: 85px; max-width: 100px; box-sizing: border-box; }
#monitor-table-wrap .m-table th.col-address, #monitor-table-wrap .m-table td.col-address { width: 85px; min-width: 80px; max-width: 95px; box-sizing: border-box; }
#monitor-table-wrap .m-table th.col-type, #monitor-table-wrap .m-table td.col-type { width: 130px; min-width: 115px; max-width: 145px; box-sizing: border-box; }
#monitor-table-wrap .m-table th.col-comment, #monitor-table-wrap .m-table td.col-comment { width: 130px; min-width: 110px; max-width: 150px; white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; box-sizing: border-box; }
#monitor-table-wrap .m-table th[data-loc="Col_Delete"], #monitor-table-wrap .m-table td.col-delete { width: 64px; min-width: 60px; max-width: 72px; white-space: nowrap; box-sizing: border-box; }

/* Column Toggle Dropdown */
.m-col-toggle-dropdown {
  user-select: none;
}
.m-col-toggle-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  color: #e2e8f0;
  transition: background 0.12s;
}
.m-col-toggle-item:hover {
  background: #1e293b;
}
.m-col-toggle-item input[type="checkbox"] {
  cursor: pointer;
  accent-color: #0284c7;
  width: 14px;
  height: 14px;
  margin: 0;
}

/* Bottom HMI Page Tabs Bar (Matches Monitor Sheet Tabs Bar) */
.hmi-screen-wrapper {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  gap: 0 !important;
}

.hmi-canvas {
  border-radius: 12px 12px 0 0 !important;
  border-bottom: none !important;
  margin-bottom: 0 !important;
}

#hmi-sheet-tabs-bar {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  background: #070c18;
  border-left: 2px solid #1e293b;
  border-right: 2px solid #1e293b;
  border-bottom: 2px solid #1e293b;
  border-top: none !important;
  border-radius: 0 0 12px 12px;
  margin-top: 0 !important;
  padding: 0 12px;
  height: 38px;
  font-size: 12px;
  position: relative;
  box-sizing: border-box;
}

#hmi-sheet-tabs-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: #1e293b;
  z-index: 1;
}

#hmi-page-tabs-container {
  display: flex;
  align-items: stretch;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden !important;
  max-width: 82%;
  height: 100%;
  position: relative;
  z-index: 2;
}
#hmi-page-tabs-container::-webkit-scrollbar {
  height: 3px;
}
#hmi-page-tabs-container::-webkit-scrollbar:vertical {
  display: none !important;
  width: 0 !important;
}
#hmi-page-tabs-container::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 2px;
}

.hmi-sheet-tab {
  height: 37px !important;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  transition: all 0.15s ease;
  box-sizing: border-box;
  border-radius: 0 0 6px 6px !important;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  position: relative;
  top: 0;
  flex-shrink: 0;
  z-index: 2;
}

.hmi-sheet-tab:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #f8fafc;
}

.hmi-sheet-tab.active {
  background: #070d19 !important;
  color: #38bdf8 !important;
  font-weight: 700;
  border-left: 1px solid #1e293b !important;
  border-right: 1px solid #1e293b !important;
  border-bottom: 1px solid #1e293b !important;
  border-top: none !important;
  border-radius: 0 0 6px 6px !important;
  box-shadow: none !important;
  position: relative;
  top: 0 !important;
  height: 38px !important;
  z-index: 3 !important;
}

.hmi-sheet-tab-badge {
  font-size: 10px;
  font-weight: bold;
  padding: 1px 6px;
  border-radius: 10px;
  transition: all 0.15s ease;
}
.hmi-sheet-tab.active .hmi-sheet-tab-badge {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
}
.hmi-sheet-tab:not(.active) .hmi-sheet-tab-badge {
  color: #64748b;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hmi-sheet-tab-del {
  font-size: 13px;
  font-weight: bold;
  color: #64748b;
  padding: 0 2px;
  line-height: 1;
  cursor: pointer;
  margin-left: 2px;
  transition: color 0.15s;
}
.hmi-sheet-tab-del:hover {
  color: #f87171 !important;
}

/* ====================================================
   PLC Label & BackupData Explorer Tab Styles
   ==================================================== */
.label-explorer-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.label-dropzone {
  border: 2px dashed #0284c7;
  border-radius: 12px;
  background: rgba(2, 132, 199, 0.04);
  padding: 50px 20px;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  box-sizing: border-box;
}
.label-dropzone:hover, .label-dropzone.dragover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.15);
}

.label-summary-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: #090f1d;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 12px 18px;
}

.label-stats-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.label-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #0d1629;
  border: 1px solid #1e293b;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  color: #94a3b8;
  font-weight: 500;
}
.label-stat-chip strong {
  color: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.label-stat-chip.stat-global { border-color: rgba(56, 189, 248, 0.35); }
.label-stat-chip.stat-global strong { color: #38bdf8; }
.label-stat-chip.stat-module { border-color: rgba(168, 85, 247, 0.35); }
.label-stat-chip.stat-module strong { color: #c084fc; }
.label-stat-chip.stat-local { border-color: rgba(234, 179, 8, 0.35); }
.label-stat-chip.stat-local strong { color: #facc15; }
.label-stat-chip.stat-const { border-color: rgba(249, 115, 22, 0.35); }
.label-stat-chip.stat-const strong { color: #fb923c; }

.label-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: #0a1122;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 10px 14px;
}

.label-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.label-pill {
  background: #0f172a;
  border: 1px solid #334155;
  color: #94a3b8;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.label-pill:hover {
  background: #1e293b;
  color: #f8fafc;
}
.label-pill.active {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

.label-table-wrap {
  background: #0a1120;
  border: 1px solid #1e293b;
  border-bottom: none !important;
  border-radius: 8px 8px 0 0;
  overflow: auto;
  max-height: 640px;
}

.label-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.label-table th {
  position: sticky;
  top: 0;
  background: #0f172a;
  color: #94a3b8;
  padding: 10px 12px;
  border-bottom: 1px solid #334155;
  font-weight: 600;
  z-index: 2;
  white-space: nowrap;
}

.label-table td {
  padding: 7px 12px;
  border-bottom: 1px solid #141f33;
  color: #e2e8f0;
  vertical-align: middle;
}

.label-table tr:hover td {
  background: rgba(56, 189, 248, 0.05);
}

.label-cat-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}
.label-cat-global { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.label-cat-module { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.label-cat-local { background: rgba(234, 179, 8, 0.15); color: #facc15; border: 1px solid rgba(234, 179, 8, 0.3); }
.label-cat-constant { background: rgba(249, 115, 22, 0.15); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.3); }
.label-cat-struct { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.3); }

.label-phys-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  font-size: 11px;
  background: #064e3b;
  color: #34d399;
  border: 1px solid #059669;
}

.label-addr-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  color: #64748b;
}

.label-comment-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #94a3b8;
  font-size: 11px;
}

.label-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 14px;
  background: #0a1120;
  border-left: 1px solid #1e293b;
  border-right: 1px solid #1e293b;
  border-top: 1px solid #1e293b;
  border-bottom: none !important;
  border-radius: 0 !important;
  margin-top: 0 !important;
  font-size: 12px;
  color: #94a3b8;
}

.m-page-btn {
  min-width: 28px;
  height: 26px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid #1e293b;
  background: #0f172a;
  color: #94a3b8;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
}
.m-page-btn:hover {
  background: #1e293b;
  color: #f8fafc;
  border-color: #38bdf8;
}
.m-page-btn.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
  font-weight: 700;
}
.m-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}




/* Custom Input Combobox with Dynamic Dropdown */
.m-combo-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.m-combo-wrap .m-combo-input {
  width: 100%;
  box-sizing: border-box;
}
.m-combo-wrap.has-dropdown .m-combo-input {
  padding-right: 36px !important;
}
.m-combo-btn {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  width: 32px;
  background: transparent;
  border: none;
  border-left: 1px solid var(--m-border, rgba(255, 255, 255, 0.1));
  border-radius: 0 6px 6px 0;
  color: var(--m-text-muted, #94a3b8);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  z-index: 2;
  padding: 0;
}
.m-combo-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #38bdf8;
}
.m-combo-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #0f172a;
  border: 1px solid #38bdf8;
  border-radius: 6px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px 0;
}
.m-combo-item {
  padding: 8px 12px;
  font-size: 13px;
  color: #f1f5f9;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.m-combo-item:hover, .m-combo-item.active {
  background: #0284c7;
  color: #ffffff;
}
.m-combo-item-desc {
  font-size: 11px;
  color: #94a3b8;
  margin-left: 8px;
}
.m-combo-item:hover .m-combo-item-desc, .m-combo-item.active .m-combo-item-desc {
  color: #e0f2fe;
}

/* Standalone Windows Desktop Application Banner */
#melsec-standalone-box {
  display: block;
}

/* GX3 Constant Badges & Highlights */
.gx3-const-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  padding: 1px 5px;
  margin-left: 6px;
  border-radius: 4px;
  background: rgba(168, 85, 247, 0.22);
  border: 1px solid #a855f7;
  color: #d8b4fe;
  vertical-align: middle;
  letter-spacing: 0.5px;
}

.user-const-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  padding: 1px 5px;
  margin-left: 6px;
  border-radius: 4px;
  background: rgba(14, 165, 233, 0.2);
  border: 1px solid #38bdf8;
  color: #7dd3fc;
  vertical-align: middle;
  letter-spacing: 0.5px;
}

.gx3-const-tag {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.2;
  padding: 1px 6px;
  margin-left: 6px;
  border-radius: 4px;
  background: linear-gradient(135deg, #7c3aed, #9333ea);
  color: #ffffff;
  border: 1px solid #a855f7;
  vertical-align: middle;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.user-const-tag {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.2;
  padding: 1px 6px;
  margin-left: 6px;
  border-radius: 4px;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  border: 1px solid #38bdf8;
  vertical-align: middle;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.label-cat-badge.label-cat-gx3-constant {
  background: rgba(147, 51, 234, 0.2);
  border: 1px solid #9333ea;
  color: #d8b4fe;
}

.label-cat-badge.label-cat-user-constant {
  background: rgba(14, 165, 233, 0.2);
  border: 1px solid #0284c7;
  color: #7dd3fc;
}

.vs-intelli-item.is-gx3-constant {
  border-left: 2px solid #a855f7;
}

/* ====================================================
   Pro-face GP-Pro EX HMI Simulator & Digital Twin Styles
   ==================================================== */
.hmi-simul-container {
  width: 100%;
  min-height: 560px;
  background: #090e1a;
  border-radius: 0 0 8px 8px;
  display: flex;
  flex-direction: column;
}

.prx-dropzone-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  min-height: 480px;
}

.prx-dropzone {
  width: 100%;
  max-width: 680px;
  border: 2px dashed #0284c7;
  border-radius: 10px;
  background: rgba(2, 132, 199, 0.05);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.prx-dropzone:hover, .prx-dropzone.dragover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  transform: scale(1.008);
}

.prx-viewport-view {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px;
  overflow: auto;
  background: #050811;
}

/* Outer Industrial Hardware Panel Bezel */
.prx-bezel {
  background: #2b303c;
  border: 4px solid #1a1e27;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), inset 0 2px 4px rgba(255, 255, 255, 0.15), inset 0 -3px 6px rgba(0, 0, 0, 0.6);
  padding: 12px 14px 14px 14px;
  display: flex;
  flex-direction: column;
  position: relative;
  user-select: none;
  transform-origin: top center;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.prx-bezel-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px 8px 4px;
  border-bottom: 2px solid #1e232d;
  margin-bottom: 8px;
}

.prx-bezel-logo {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #cbd5e1;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.prx-bezel-leds {
  display: flex;
  align-items: center;
  gap: 12px;
}

.prx-bezel-led {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  font-family: monospace;
}

.prx-bezel-led .led-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #334155;
  border: 1px solid #1e293b;
  display: inline-block;
  transition: all 0.15s ease;
}

.prx-bezel-led.on-green .led-dot {
  background: #22c55e;
  border-color: #4ade80;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.9);
}

.prx-bezel-led.on-amber .led-dot {
  background: #f59e0b;
  border-color: #fbbf24;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.9);
}

/* 640x480 VGA Canvas Digital Twin Screen */
.prx-touch-screen {
  width: 640px;
  height: 480px;
  background-color: #9e9e9e;
  border: 3px inset #3a3a3a;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  font-family: "Malgun Gothic", "Gulim", Dotum, sans-serif;
  color: #ffffff;
  box-sizing: border-box;
}

/* Header Strip (Height 36px, White Background matching real HMI) */
.prx-header-strip {
  height: 36px;
  background: #ffffff;
  border-bottom: 2px solid #505050;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  font-size: 11px;
  flex-shrink: 0;
  box-sizing: border-box;
}

.prx-brand-block {
  display: flex;
  align-items: center;
  gap: 3px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.prx-aq-icon {
  background: #b91c1c;
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  padding: 1px 3px;
  border-radius: 2px;
  border: 1px solid #7f1d1d;
}

.prx-brand-name {
  color: #111827;
  font-size: 13px;
  font-family: Arial, sans-serif;
  font-weight: 900;
}

.prx-header-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #334155;
  font-size: 10px;
  font-family: monospace;
}

.prx-header-boxes {
  display: flex;
  align-items: center;
  gap: 4px;
}

.prx-blue-box {
  background: #1e293b;
  border: 1px solid #0284c7;
  color: #e0f2fe;
  padding: 1px 4px;
  font-size: 10px;
  font-family: monospace;
  font-weight: 600;
  white-space: nowrap;
}

.prx-flag-box {
  font-size: 16px;
}

.prx-header-clock {
  font-family: monospace;
  font-size: 9.5px;
  color: #0f172a;
  line-height: 1.15;
  text-align: right;
  white-space: nowrap;
}

/* Dynamic Screen Canvas (Height 408px, flex:1) */
.prx-screen-canvas {
  width: 640px;
  height: 408px;
  flex: 1;
  min-height: 0;
  background: #9e9e9e;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  box-sizing: border-box;
}

/* Laser Welding Digital Twin Layout (Main Screen 1) */
.prx-screen-body-weld {
  width: 100%;
  height: 100%;
  display: flex;
  padding: 6px 8px;
  gap: 8px;
  box-sizing: border-box;
  background: #9e9e9e;
  color: #ffffff;
  font-family: "Malgun Gothic", "Gulim", Dotum, sans-serif;
}

/* Left Column: Workstation Box + Lower BCR & Alarm Console (472px) */
.prx-weld-leftcol {
  width: 472px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-sizing: border-box;
}

/* Upper Workstation Schematic Box (Rounded rect, dark gray) */
.prx-weld-workbox {
  height: 254px;
  background: #707070;
  border: 2px solid #484848;
  border-radius: 12px;
  display: flex;
  padding: 6px 10px;
  position: relative;
  box-sizing: border-box;
}

/* Table 1 & Table 2 Control Columns */
.prx-table-col {
  width: 92px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  z-index: 2;
}

.prx-thin-line {
  height: 1.5px;
  background: #555555;
}

.prx-tact-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  align-items: center;
}

.prx-tact-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 2px 4px;
  border-radius: 2px;
  transition: all 0.08s ease;
  user-select: none;
  font-family: Arial, sans-serif;
}

.prx-tact-btn:active {
  transform: scale(0.96);
  filter: brightness(0.85);
}

.prx-icon-ring {
  width: 14px;
  height: 14px;
  border: 2.5px solid #ffffff;
  border-radius: 50%;
  box-sizing: border-box;
  display: inline-block;
  transition: all 0.1s ease;
}

.prx-tact-btn.active-green .prx-icon-ring {
  background: #22c55e;
  border-color: #4ade80;
  box-shadow: 0 0 8px #22c55e;
}

.prx-tact-btn.active-blue {
  color: #38bdf8;
  text-shadow: 0 0 6px #0284c7;
}

.prx-icon-power {
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.prx-icon-square {
  font-size: 12px;
  line-height: 1;
}

/* Sensor Gauges Table */
.prx-sensor-tbl {
  width: 100%;
  border-collapse: collapse;
  border: 1.5px solid #b0b0b0;
  background: #686868;
  font-size: 10px;
  margin-top: 2px;
}

.prx-sensor-tbl td {
  border: 1px solid #b0b0b0;
  padding: 2px 4px;
  height: 17px;
  box-sizing: border-box;
  color: #ffffff;
  font-weight: 600;
  white-space: nowrap;
}

.prx-stbl-val {
  width: 32px;
  background: #1e3a8a;
  color: #38bdf8;
  font-family: monospace;
  font-weight: 700;
  text-align: center;
}

.prx-stbl-lamp {
  width: 32px;
  background: #555555;
  text-align: center;
}

.prx-stbl-lamp.on {
  background: #22c55e;
  box-shadow: inset 0 0 4px #15803d;
}

/* Center Schematic: Horizontal Line, Vertical Tracks, Two Pallets */
.prx-center-schematic {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 8px;
}

.prx-top-subtle-line {
  position: absolute;
  top: 18px;
  width: 170px;
  height: 1.5px;
  background: #888888;
}

.prx-rail-container {
  position: absolute;
  top: 38px;
  bottom: 65px;
  width: 120px;
  display: flex;
  justify-content: space-between;
}

.prx-vert-guide {
  width: 1px;
  height: 100%;
  background: #888888;
}

.prx-pallets-row {
  display: flex;
  gap: 14px;
  z-index: 2;
}

.prx-red-pallet {
  width: 76px;
  height: 50px;
  background: #8b1e1e;
  border: 1.5px solid #000000;
  position: relative;
  display: flex;
  overflow: hidden;
  box-shadow: 1px 1px 4px rgba(0,0,0,0.5);
}

.prx-pallet-side {
  width: 4px;
  height: 100%;
  background: repeating-linear-gradient(to bottom, #ffffff, #ffffff 3px, #000000 3px, #000000 6px);
  flex-shrink: 0;
}

.prx-pallet-ribs {
  flex: 1;
  height: 100%;
  background: repeating-linear-gradient(to bottom, #a32222, #a32222 2px, #521010 2px, #521010 4px);
}

/* Moving Laser Gantry Head */
.prx-gantry-head {
  position: absolute;
  top: 12px;
  width: 20px;
  height: 38px;
  background: linear-gradient(to right, #333, #555, #222);
  border: 1px solid #111;
  z-index: 5;
  transition: left 0.4s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.prx-gantry-nozzle {
  width: 5px;
  height: 6px;
  background: #bbb;
  border: 1px solid #333;
  margin-top: auto;
}

.prx-laser-beam {
  width: 2px;
  height: 140px;
  background: #38bdf8;
  box-shadow: 0 0 10px #00e5ff;
  opacity: 0;
  transition: opacity 0.1s;
  position: absolute;
  top: 44px;
}

.prx-laser-beam.firing {
  opacity: 1;
  animation: laserPulse 0.1s infinite alternate;
}

@keyframes laserPulse {
  0% { transform: scaleX(1); filter: brightness(1); }
  100% { transform: scaleX(2.5); filter: brightness(1.8); }
}

/* Lower Area: BCR Lines and Black Alarm Console */
.prx-weld-lower {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.prx-bcr-line {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 15px;
}

.prx-bcr-lbl {
  font-size: 10.5px;
  font-weight: 700;
  color: #ffffff;
  width: 62px;
  font-family: Arial, sans-serif;
  white-space: nowrap;
}

.prx-bcr-terminal {
  flex: 1;
  height: 14px;
  background: #000000;
  border: 1px solid #222222;
  color: #00ff66;
  font-family: monospace;
  font-size: 10px;
  font-weight: bold;
  line-height: 14px;
  padding: 0 4px;
  overflow: hidden;
  white-space: nowrap;
}

.prx-alarm-console {
  height: 72px;
  background: #000000;
  border: 1.5px solid #ffffff;
  padding: 3px 6px;
  font-family: monospace;
  font-size: 10px;
  color: #e2e8f0;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
  gap: 1px;
  box-sizing: border-box;
}

/* Right Column: Control Panel Area (150px) */
.prx-weld-rightpanel {
  width: 150px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-sizing: border-box;
}

.prx-ctrl-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

/* Standard 3D Outset Buttons */
.prx-outset-btn {
  font-size: 10.5px;
  font-weight: 700;
  text-align: center;
  border: 2px outset #ffffff;
  border-radius: 2px;
  cursor: pointer;
  user-select: none;
  padding: 4px 2px;
  line-height: 1.15;
  font-family: "Malgun Gothic", "Gulim", Dotum, sans-serif;
  transition: all 0.05s ease;
  box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.prx-outset-btn:active {
  border-style: inset;
  transform: translate(1px, 1px);
  filter: brightness(0.9);
}

.prx-col-lightblue {
  background: #9ec0f8;
  color: #000000;
}

.prx-col-red {
  background: #ff0000;
  color: #000000;
  font-weight: 900;
}

.prx-weld-opbox {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.prx-weld-oplabel {
  font-size: 10.5px;
  font-weight: 700;
  color: #000000;
  margin-bottom: 2px;
  text-align: center;
  letter-spacing: 0.5px;
}

.prx-weld-opframe {
  border: 2px inset #ffffff;
  background: #c8c0b0;
  padding: 3px;
  width: 100%;
  box-sizing: border-box;
}

.prx-col-mustard {
  background: #94781b;
  color: #ffffff;
  border-color: #c0a030;
}

.prx-col-mustard.active {
  box-shadow: 0 0 6px #facc15;
  border-color: #fef08a;
}

.prx-col-darkgreen {
  background: #005828;
  color: #ffffff;
  border-color: #008840;
}

.prx-col-darkgreen.active {
  box-shadow: 0 0 6px #4ade80;
  border-color: #86efac;
}

.prx-col-brown {
  background: #8b3a1a;
  color: #ffffff;
  border-color: #b05028;
}

.prx-col-crimson {
  background: #990000;
  color: #ffffff;
  border-color: #cc0000;
}

.prx-col-medgreen {
  background: #38a038;
  color: #000000;
  border-color: #ffffff;
}

.prx-col-lime {
  background: #9ca800;
  color: #000000;
  border-color: #ffffff;
}

/* Bottom Navigation & Command Bar (Height 36px) */
.prx-screen-nav-bar {
  height: 36px;
  background: #9e9e9e;
  border-top: 2px inset #707070;
  display: flex;
  align-items: center;
  padding: 2px 4px;
  gap: 4px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.prx-nav-tabs-left {
  display: flex;
  gap: 3px;
  height: 100%;
  align-items: center;
}

.prx-tab-btn {
  background: #3c3c3c;
  border: 2px outset #ffffff;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  height: 28px;
  padding: 0 10px;
  cursor: pointer;
  border-radius: 1px;
  font-family: "Malgun Gothic", "Gulim", Dotum, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: all 0.08s ease;
}

.prx-tab-btn:active {
  border-style: inset;
  transform: translate(1px, 1px);
}

.prx-tab-btn.active {
  background: #a0c0ff;
  border: 2px inset #5070c0;
  color: #000000;
}

.prx-nav-cmds-right {
  display: flex;
  gap: 4px;
  margin-left: auto;
  height: 100%;
  align-items: center;
}

.prx-nav-cmds-right .prx-outset-btn {
  height: 28px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

/* Zero-Jank HMI Modal Device Warning Container (Prevents Layout Shift) */
.hmi-modal-dev-warn {
  font-size: 11px;
  line-height: 16px;
  min-height: 18px;
  margin-top: 4px;
  margin-bottom: 2px;
  box-sizing: border-box;
  transition: opacity 0.15s ease, color 0.15s ease;
  visibility: hidden;
  opacity: 0;
  display: block !important; /* Preserves fixed reservation so below forms never shift */
  word-break: break-word;
}

.hmi-modal-dev-warn.is-visible {
  visibility: visible;
  opacity: 1;
}

/* ==========================================================================
   HMI Modern Cyberpunk HUD Floating Cursor-Following Tooltip
   ========================================================================== */
#hmi-floating-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100000;
  pointer-events: none;
  user-select: none;
  width: max-content;
  max-width: none;
  white-space: nowrap;
  background: rgba(10, 16, 31, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85), 0 0 16px rgba(56, 189, 248, 0.22);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s cubic-bezier(0.16, 1, 0.3, 1), transform 0.05s linear;
  will-change: transform, opacity;
  box-sizing: border-box;
}

#hmi-floating-tooltip.is-active {
  opacity: 1;
  visibility: visible;
}

/* Row 1: User Display Name & Data Type */
.hmi-ft-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.hmi-ft-title-prefix {
  font-size: 11px;
  line-height: 1;
}

.hmi-ft-user-label {
  font-size: 12px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.hmi-ft-datatype-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 2px 7px;
  border-radius: 4px;
  line-height: 1.2;
  margin-left: auto;
  white-space: nowrap;
}

/* Row 2: Target Full Name (Label / Device) */
.hmi-ft-row-target {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  padding: 4px 8px;
  white-space: nowrap;
}

.hmi-ft-target-tag {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 3px;
  line-height: 1.2;
}

.hmi-ft-full-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  color: #38bdf8;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

/* Multi-dimensional array dimension highlight badge */
.dim-highlight-num {
  color: #38bdf8 !important;
  font-weight: 800 !important;
  background: rgba(56, 189, 248, 0.25) !important;
  padding: 1px 6px !important;
  border-radius: 4px !important;
  border: 1px solid rgba(56, 189, 248, 0.5) !important;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.6) !important;
  display: inline-block;
  margin: 0 1px;
}

.custom-dim-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}

.custom-dim-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0f172a;
  border: 1px solid #0284c7;
  color: #f8fafc;
  padding: 5px 10px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
  user-select: none;
  min-height: 32px;
  box-shadow: 0 0 0 1px rgba(2, 132, 199, 0.2);
}

.custom-dim-btn:hover, .custom-dim-btn:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}

.custom-dim-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 320px;
  background: #0b1329;
  border: 1px solid #1e293b;
  border-radius: 6px;
  box-shadow: 0 12px 28px -5px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
  z-index: 1000;
  margin: 0;
  padding: 4px;
  list-style: none;
  display: none;
}

.custom-dim-menu.open {
  display: block;
}

.custom-dim-item {
  padding: 6px 10px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 500;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.custom-dim-item:hover, .custom-dim-item.selected {
  background: rgba(56, 189, 248, 0.15);
  color: #f8fafc;
}

.custom-dim-item.selected {
  border-left: 2px solid #38bdf8;
}

/* ----------------------------------------------------
   Watch Window Tree View (Structures & Arrays Expandable Nodes)
   ---------------------------------------------------- */
.m-container-row {
  background: rgba(14, 165, 233, 0.05);
  font-weight: 600;
}
.m-container-row:hover {
  background: rgba(14, 165, 233, 0.12) !important;
}
.m-tree-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
  padding: 0;
  margin-right: 6px;
  vertical-align: middle;
  transition: all 0.15s ease;
  user-select: none;
}
.m-tree-toggle-btn:hover {
  background: rgba(56, 189, 248, 0.3);
  border-color: #38bdf8;
  color: #ffffff;
  transform: scale(1.1);
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.4);
}
.m-tree-leaf-bullet {
  display: inline-block;
  color: #64748b;
  margin-right: 6px;
  font-family: Consolas, monospace;
  font-size: 11px;
  user-select: none;
  opacity: 0.8;
}
.m-tree-indent-wrap {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}



