/* RapidRTL Main Stylesheet */
:root {
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Dark Theme (Default) */
  --bg-app: #0d1117;
  --bg-pane: #161b22;
  --bg-canvas: #090d13;
  --bg-card: #21262d;
  --bg-hover: #30363d;
  --border-color: #30363d;
  --text-main: #e6edf3;
  --text-muted: #8b949e;
  --accent-primary: #e3b341;
  --accent-hover: #d29922;
  --accent-active: #f0883e;
  --accent-wire: #58a6ff;
  --accent-highlight: #ff9800;
  --danger-color: #f85149;
  --success-color: #3fb950;
  --grid-dot: #2a313c;
  --shadow-color: rgba(0, 0, 0, 0.5);
}

body.theme-light {
  --bg-app: #f6f8fa;
  --bg-pane: #ffffff;
  --bg-canvas: #fafbfc;
  --bg-card: #eaeef2;
  --bg-hover: #e1e4e8;
  --border-color: #d0d7de;
  --text-main: #1f2328;
  --text-muted: #656d76;
  --accent-primary: #1f883d;
  --accent-hover: #1a7f37;
  --accent-active: #d4a72c;
  --accent-wire: #0969da;
  --accent-highlight: #d97706;
  --danger-color: #cf222e;
  --success-color: #1a7f37;
  --grid-dot: #d8dee4;
  --shadow-color: rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* App Header */
#app-header {
  height: 48px;
  background: var(--bg-pane);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  user-select: none;
  z-index: 100;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.header-left, .header-center, .header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.2px;
  color: var(--text-main);
  text-decoration: none;
}

.brand-icon {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #f0883e, #d29922);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-weight: 900;
  font-size: 12px;
}

.brand-badge {
  font-size: 9px;
  font-weight: 600;
  background: #30363d;
  color: var(--accent-primary);
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}

.header-select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 5px;
  outline: none;
  cursor: pointer;
}

.header-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.header-btn:hover {
  background: var(--bg-hover);
}

.header-btn.btn-primary {
  background: #f0883e;
  border-color: #f0883e;
  color: #0d1117;
  font-weight: 700;
  padding: 6px 14px;
}

.header-btn.btn-primary:hover {
  background: #f89a54;
  border-color: #f89a54;
}

.header-btn.active {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* App Main Layout */
#app-body {
  height: calc(100% - 48px);
  display: flex;
  flex-direction: row;
  position: relative;
  overflow: hidden;
}

/* Left: Source Editor Pane (40%) */
#pane-source {
  width: 40%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-pane);
  border-right: 1px solid var(--border-color);
  position: relative;
  min-width: 200px;
}

#pane-source.collapsed {
  width: 38px !important;
  min-width: 38px !important;
}

.source-collapsed-strip {
  display: none;
  height: 100%;
  width: 100%;
  background: var(--bg-pane);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  padding: 12px 8px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

#pane-source.collapsed .source-collapsed-strip {
  display: flex;
}

#pane-source.collapsed .pane-header,
#pane-source.collapsed #editor-container,
#pane-source.collapsed .file-tabs-bar {
  display: none !important;
}

/* Divider / Resizer */
.resizer-divider {
  width: 6px;
  height: 100%;
  background: transparent;
  cursor: col-resize;
  position: relative;
  z-index: 10;
  transition: background 0.2s;
  user-select: none;
}

.resizer-divider:hover, .resizer-divider.dragging {
  background: var(--accent-primary);
}

/* Center: Schematic Canvas Pane (40%) */
#pane-schematic {
  width: 40%;
  flex: 1;
  height: 100%;
  background: var(--bg-canvas);
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 250px;
  overflow: hidden;
}

.schematic-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

/* Right: Inspector & Stats Pane (20%) */
#pane-inspector {
  width: 20%;
  min-width: 220px;
  max-width: 380px;
  height: 100%;
  background: var(--bg-pane);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition: width 0.2s ease, height 0.2s ease, transform 0.2s ease;
  z-index: 25;
}

#pane-inspector.collapsed {
  display: none !important;
}

/* Inspector Tabs & Body */
.inspector-tabs {
  display: flex;
  flex-wrap: wrap;
  background: var(--bg-pane);
  border-bottom: 1px solid var(--border-color);
  padding: 2px 4px;
  gap: 2px;
  flex-shrink: 0;
}

.inspector-tabs .tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  padding: 6px 7px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  outline: none;
  transition: all 0.15s ease;
  font-family: var(--font-sans);
  flex-shrink: 0;
}

.inspector-tabs .tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-hover);
  border-radius: 4px 4px 0 0;
}

.inspector-tabs .tab-btn.active {
  color: var(--accent-wire);
  border-bottom-color: var(--accent-wire);
  background: transparent;
  font-weight: 700;
}

.inspector-tabs .tab-btn .badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(139, 148, 158, 0.2);
  color: var(--text-muted);
}

.inspector-tabs .tab-btn.active .badge {
  background: rgba(88, 166, 255, 0.2);
  color: var(--accent-wire);
}

.inspector-body {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.empty-state, .stats-loading {
  color: var(--text-muted);
  text-align: center;
  padding: 24px 16px;
  font-size: 11.5px;
  line-height: 1.5;
}

/* Pane Header Common */
.pane-header {
  height: 38px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: var(--bg-pane);
  user-select: none;
}

.pane-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.pane-title-dot {
  width: 7px;
  height: 7px;
  background: var(--accent-primary);
  border-radius: 50%;
  display: inline-block;
}

.pane-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-pane);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: 90%;
  max-width: 580px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 30px var(--shadow-color);
  overflow: hidden;
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
  font-size: 13px;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-card);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-group .form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-control {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: 5px;
  font-size: 13px;
  outline: none;
}

.form-control:focus {
  border-color: var(--accent-primary);
}

.radio-group, .checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-item, .checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

/* Spinner */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

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

/* Top Entity Selector Bar */
.top-entity-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--bg-pane);
  border-bottom: 1px solid var(--border-color);
  font-size: 11px;
  user-select: none;
}

.top-entity-label {
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 10px;
  white-space: nowrap;
}

.top-entity-input {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  width: 130px;
  outline: none;
}

.top-entity-input:focus {
  border-color: var(--accent-primary);
}

.top-entity-select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 11px;
  cursor: pointer;
  outline: none;
}

/* Admin Projects & Users Tables */
.projects-table, .users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  background: var(--bg-card);
}

.projects-table th, .users-table th {
  background: var(--bg-pane);
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 600;
}

.projects-table td, .users-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.projects-table tr:hover td, .users-table tr:hover td {
  background: var(--bg-hover);
}

.tag-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}

.tag-admin {
  background: rgba(163, 113, 247, 0.2);
  color: #d2a8ff;
  border: 1px solid rgba(163, 113, 247, 0.4);
}

.tag-user {
  background: rgba(88, 166, 255, 0.15);
  color: #58a6ff;
  border: 1px solid rgba(88, 166, 255, 0.3);
}

.tag-toggle {
  cursor: pointer;
  font-family: inherit;
  line-height: 1.3;
  transition: all 0.15s ease-in-out;
  user-select: none;
}

.tag-toggle:hover {
  filter: brightness(1.25);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.tag-toggle:active {
  transform: scale(0.96);
}

.tag-visible {
  background: rgba(35, 134, 54, 0.2);
  color: #3fb950;
  border: 1px solid rgba(63, 185, 80, 0.4);
}

.tag-hidden {
  background: rgba(139, 148, 158, 0.2);
  color: #8b949e;
  border: 1px solid rgba(139, 148, 158, 0.4);
}

.tag-public {
  background: rgba(88, 166, 255, 0.15);
  color: #58a6ff;
  border: 1px solid rgba(88, 166, 255, 0.3);
}

.tag-protected {
  background: rgba(218, 54, 51, 0.15);
  color: #f85149;
  border: 1px solid rgba(248, 81, 73, 0.3);
}

.share-link-input {
  background: var(--bg-pane);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  width: 240px;
}

/* ==========================================================================
   Share Modal (Link & Embed like RapidRTL)
   ========================================================================== */

.share-tab-header {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  padding: 0 16px;
}

.share-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.share-tab-btn:hover {
  color: var(--text-primary);
}

.share-tab-btn.active {
  color: var(--accent-wire);
  border-bottom-color: var(--accent-wire);
}

.share-instruction {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 14px;
}

.share-bar-container {
  display: flex;
  gap: 8px;
  align-items: center;
}

.share-link-text {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 6px;
}

.btn-share-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-wire);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-share-copy:hover {
  background: #1f6feb;
}

.embed-height-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.embed-height-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-height-choice {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-height-choice:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.btn-height-choice.active {
  background: rgba(56, 139, 253, 0.15);
  border-color: var(--accent-wire);
  color: var(--accent-wire);
}

.share-embed-textarea {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px;
  border-radius: 6px;
  resize: vertical;
  line-height: 1.4;
  margin-bottom: 10px;
}

.embed-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.embed-disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  flex: 1;
}

/* ==========================================================================
   Compare Tab & FPGA Target Styles
   ========================================================================== */

.compare-table, .fpga-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  margin-top: 8px;
}

.compare-table th, .fpga-stats-table th {
  background: var(--bg-card);
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 600;
}

.compare-table td, .fpga-stats-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.compare-table tr:hover td, .fpga-stats-table tr:hover td {
  background: var(--bg-hover);
}

.delta-pos {
  color: #3fb950;
  font-weight: 600;
}

.delta-neg {
  color: #f85149;
  font-weight: 600;
}

.delta-zero {
  color: var(--text-muted);
}

.fpga-disclaimer-box {
  background: rgba(139, 148, 158, 0.1);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 12px;
}

.equiv-banner {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.4;
  margin-top: 8px;
}

.equiv-banner.proven {
  background: rgba(46, 160, 67, 0.15);
  border: 1px solid rgba(46, 160, 67, 0.4);
  color: #3fb950;
}

.equiv-banner.failed {
  background: rgba(248, 81, 73, 0.15);
  border: 1px solid rgba(248, 81, 73, 0.4);
  color: #f85149;
}

.equiv-banner.unknown {
  background: rgba(210, 153, 34, 0.15);
  border: 1px solid rgba(210, 153, 34, 0.4);
  color: #d29922;
}

/* Debug Dropdown Menu */
.menu-dropdown-wrap {
  position: relative;
  display: inline-block;
}

.menu-dropdown-wrap:hover .dropdown-menu-floating {
  display: block !important;
}

.dropdown-menu-floating {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-card, #161b22);
  border: 1px solid var(--border-color, #30363d);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  min-width: 230px;
  z-index: 1000;
  padding: 4px 0;
  margin-top: 4px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  color: var(--text-main, #c9d1d9);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.dropdown-item:hover {
  background: var(--bg-hover, #21262d);
  color: #ffffff;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color, #30363d);
  margin: 4px 0;
}

@keyframes spinReset360 {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.btn-spinning svg {
  animation: spinReset360 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile Navigation Bar (hidden on desktop, sticky on <= 768px) */
.mobile-nav-bar {
  display: none;
}

/* Mobile & Small Screen Responsive Overhaul */
@media (max-width: 768px) {
  html, body {
    height: auto !important;
    min-height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  .mobile-nav-bar {
    display: flex !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 150 !important;
    background: var(--bg-pane) !important;
    border-bottom: 2px solid var(--border-color) !important;
    padding: 6px 8px !important;
    gap: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
  }

  .mobile-nav-btn {
    flex: 1 1 0;
    min-height: 44px;
    padding: 8px 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
  }

  .mobile-nav-btn:hover,
  .mobile-nav-btn.active {
    background: var(--bg-hover) !important;
    color: var(--accent-primary) !important;
    border-color: var(--accent-primary) !important;
  }

  #app-header {
    height: auto !important;
    min-height: 48px;
    flex-wrap: wrap !important;
    padding: 6px 8px !important;
    gap: 6px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }

  .header-left, .header-center, .header-right {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .header-select {
    max-width: 120px !important;
    font-size: 11px !important;
    padding: 4px 6px !important;
    min-height: 36px;
  }

  .header-btn {
    font-size: 12px !important;
    padding: 6px 8px !important;
    min-height: 36px !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  #app-body {
    height: auto !important;
    min-height: calc(100vh - 48px) !important;
    flex-direction: column !important;
    overflow-y: visible !important;
    overflow-x: hidden !important;
    display: flex !important;
    position: relative !important;
  }

  #pane-source {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 380px !important;
    min-height: 320px !important;
    flex: none !important;
    display: flex !important;
    flex-direction: column !important;
    border-right: none !important;
    border-bottom: 2px solid var(--border-color) !important;
  }

  #editor-container {
    flex: 1 1 auto !important;
    height: calc(100% - 78px) !important;
    min-height: 220px !important;
    overflow: hidden !important;
  }

  .CodeMirror {
    height: 100% !important;
    max-width: 100vw !important;
  }

  #resizer-divider {
    display: none !important;
  }

  /* Center: Schematic Canvas Pane on Mobile */
  #pane-schematic {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 75vh !important;
    min-height: 520px !important;
    flex: none !important;
    display: flex !important;
    flex-direction: column !important;
    border-bottom: 2px solid var(--border-color) !important;
    position: relative !important;
    overflow: hidden !important;
  }

  .pane-header {
    height: auto !important;
    min-height: 42px !important;
    flex-wrap: wrap !important;
    padding: 6px 8px !important;
    gap: 6px !important;
    overflow-x: auto !important;
    max-width: 100% !important;
  }

  .pane-tools {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
  }

  .schematic-header-left {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .schematic-toolbar {
    display: flex !important;
    flex-wrap: wrap !important;
    height: auto !important;
    max-width: 100% !important;
    gap: 4px !important;
    padding: 4px 6px !important;
  }

  .schematic-btn {
    min-height: 36px !important;
    min-width: 36px !important;
    padding: 4px 8px !important;
    flex-shrink: 0 !important;
  }

  #schematic-container {
    flex: 1 1 auto !important;
    width: 100% !important;
    height: calc(100% - 44px) !important;
    min-height: 460px !important;
    position: relative !important;
    overflow: hidden !important;
    touch-action: pan-x pan-y pinch-zoom;
  }

  #schematic-svg-host {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }

  /* Right: Inspector & Stats Pane on Mobile */
  #pane-inspector {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 360px !important;
    flex: none !important;
    border-left: none !important;
  }

  /* Mobile View Modes (Exclusive Full-Screen Panes or Split View) */
  body.mobile-mode-editor #pane-source {
    display: flex !important;
    height: calc(100vh - 110px) !important;
    min-height: 420px !important;
    border-bottom: none !important;
  }
  body.mobile-mode-editor #pane-schematic {
    display: none !important;
  }
  body.mobile-mode-editor #pane-inspector {
    display: none !important;
  }

  body.mobile-mode-schematic #pane-source {
    display: none !important;
  }
  body.mobile-mode-schematic #pane-schematic {
    display: flex !important;
    height: calc(100vh - 110px) !important;
    min-height: 480px !important;
    border-bottom: none !important;
  }
  body.mobile-mode-schematic #schematic-container {
    height: calc(100% - 44px) !important;
  }
  body.mobile-mode-schematic #pane-inspector {
    display: none !important;
  }

  body.mobile-mode-inspector #pane-source {
    display: none !important;
  }
  body.mobile-mode-inspector #pane-schematic {
    display: none !important;
  }
  body.mobile-mode-inspector #pane-inspector {
    display: flex !important;
    height: calc(100vh - 110px) !important;
    min-height: 400px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  body.mobile-mode-split #pane-source {
    display: flex !important;
    height: 380px !important;
  }
  body.mobile-mode-split #pane-schematic {
    display: flex !important;
    height: 75vh !important;
    min-height: 520px !important;
  }
  body.mobile-mode-split #pane-inspector {
    display: flex !important;
    height: auto !important;
    min-height: 360px !important;
  }
}




