.nd-container {
  width: 100%;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  background-color: #f8f9fa;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  display: flex;
  flex-direction: row;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}
.nd-sidebar {
  width: 220px;
  min-width: 220px;
  height: 100%;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.nd-sidebar-header {
  padding: 10px 10px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.nd-sidebar-title {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.nd-route-select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
  color: #374151;
  background: #f9fafb;
  outline: none;
  box-sizing: border-box;
  margin-bottom: 8px;
  cursor: pointer;
}
.nd-route-select:focus {
  border-color: #3b82f6;
  background: #ffffff;
}
.nd-search-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
  color: #374151;
  background: #f9fafb;
  outline: none;
  box-sizing: border-box;
}
.nd-search-input:focus {
  border-color: #3b82f6;
  background: #ffffff;
}
.nd-search-input::placeholder {
  color: #9ca3af;
}
.nd-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.nd-sidebar-list::-webkit-scrollbar {
  width: 5px;
}
.nd-sidebar-list::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}
.nd-pad-row {
  display: flex;
  align-items: center;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  user-select: none;
}
.nd-pad-row:hover {
  background: #f3f4f6;
}
.nd-pad-row.active {
  background: #dbeafe;
}
.nd-pad-chevron {
  width: 14px;
  height: 14px;
  margin-right: 6px;
  transition: transform 0.15s;
  flex-shrink: 0;
  color: #9ca3af;
}
.nd-pad-chevron.expanded {
  transform: rotate(90deg);
}
.nd-pad-chevron.hidden {
  visibility: hidden;
}
.nd-pad-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
}
.nd-pad-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nd-pad-count {
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
  margin-left: 6px;
}
.nd-well-list {
  display: none;
}
.nd-well-list.expanded {
  display: block;
}
.nd-well-row {
  display: flex;
  align-items: center;
  padding: 4px 10px 4px 32px;
  cursor: pointer;
  font-size: 12px;
  color: #4b5563;
}
.nd-well-row:hover {
  background: #eff6ff;
}
.nd-well-row.active {
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 500;
}
.nd-well-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
}
.nd-well-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nd-well-badge {
  font-size: 10px;
  color: #9ca3af;
  margin-left: 4px;
}
.nd-section-label {
  font-size: 10px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 10px 12px 4px;
}
.nd-canvas-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}
.nd-svg {
  width: 100%;
  height: 100%;
  cursor: grab;
}
.nd-svg.grabbing {
  cursor: grabbing;
}
.nd-svg.mode-box-select {
  cursor: crosshair;
}
.nd-controls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 10;
}
.nd-control-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #dee2e6;
  background: white;
  border-radius: 6px;
  font-size: 18px;
  font-weight: bold;
  color: #495057;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: background 0.15s, transform 0.1s;
}
.nd-control-btn:hover {
  background: #f1f3f5;
  transform: scale(1.05);
}
.nd-control-btn:active {
  transform: scale(0.95);
}
.nd-zoom-label {
  font-size: 11px;
  font-weight: 600;
  color: #495057;
  text-align: center;
  padding: 4px 0;
  user-select: none;
  min-width: 36px;
}
.nd-ribbon {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 6px;
  z-index: 10;
}
.nd-ribbon-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  gap: 5px;
  border: 1px solid #dee2e6;
  background: white;
  border-radius: 6px;
  color: #495057;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: background 0.15s;
}
.nd-ribbon-btn:hover {
  background: #f1f3f5;
}
.nd-ribbon-btn.active {
  background: #4a90e2;
  color: white;
  border-color: #4a90e2;
}
.nd-ribbon-btn.active:hover {
  background: #3a7bd5;
}
.nd-ribbon-btn.snap-off {
  /* Default gray state - inherits base styles */
}
.nd-ribbon-btn.snap-on {
  /* Blue active state - uses .active styles */
  background: #4a90e2;
  color: white;
  border-color: #4a90e2;
}
.nd-ribbon-btn.snap-on:hover {
  background: #3a7bd5;
}
.nd-ribbon-btn.snap-ready {
  /* Green "ready to align" state */
  background: #10b981;
  color: white;
  border-color: #10b981;
}
.nd-ribbon-btn.snap-ready:hover {
  background: #059669;
}
.nd-ribbon-sep {
  display: inline-block;
  width: 1px;
  height: 20px;
  background: #e5e7eb;
  margin: 0 6px;
  vertical-align: middle;
}
.nd-ribbon-dropdown {
  position: relative;
}
.nd-ribbon-select {
  min-width: 120px;
  justify-content: space-between;
}
.nd-ribbon-select svg:last-child {
  opacity: 0.6;
}
.nd-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 1000;
  min-width: 140px;
  margin-top: 2px;
  padding: 2px 0;
}
.nd-dropdown-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: #495057;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
.nd-dropdown-option:hover {
  background: #f8f9fa;
}
.nd-dropdown-option.active {
  background: #2196f3;
  color: white;
}
.nd-dropdown-option svg {
  flex-shrink: 0;
}
.nd-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  color: #6c757d;
}
.nd-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 14px;
  color: #dc3545;
  text-align: center;
  padding: 20px;
}
.nd-node {
  cursor: pointer;
  transition: filter 0.15s;
}
.nd-node:hover .nd-node-shape {
  filter: brightness(1.05);
}
.nd-node.selected .nd-node-shape {
  stroke: #4a90e2;
  stroke-width: 2;
}
.nd-node.selected .nd-icon-circle {
  stroke: #4a90e2;
}
.nd-node.dimmed {
  opacity: 0.3;
}
.nd-edge {
  transition: opacity 0.15s;
}
.nd-edge.dimmed {
  opacity: 0.15;
}
.nd-edge.highlighted {
  opacity: 1;
}
.nd-edge-path {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}
.nd-edge-path.highlighted {
  stroke-width: 3.5;
  filter: brightness(1.2);
}
.nd-item-node {
  cursor: move;
  transition: opacity 0.15s, filter 0.15s;
}
.nd-item-node:active {
  cursor: grabbing;
}
.nd-item-tile-node {
  cursor: default;
}
.nd-item-node.dimmed {
  opacity: 0.3;
}
/* Consistent hover styling across all draggable elements - solid blue outline only */
.nd-node.nd-hover-active .nd-node-shape,
.nd-node:hover .nd-node-shape {
  stroke: #3b82f6;
  stroke-width: 2;
}
.nd-meter-node:hover circle:first-child {
  stroke: #3b82f6;
  stroke-width: 2;
}
.nd-item-tile-node:hover rect:first-child {
  stroke: #3b82f6;
  stroke-width: 2;
}
.nd-group-summary-node {
  cursor: pointer;
}
.nd-group-summary-node:hover rect:first-child {
  stroke: #3b82f6;
  stroke-width: 2;
}
.nd-group-summary-node.expanded rect:first-child {
  fill: #e8eaed;
  stroke: #9ca3af;
}
/* Meter color families — source of truth for meter accent colors */
.nd-meter-gas { --nd-accent: #e53935; }
.nd-meter-oil { --nd-accent: #43a047; }
.nd-meter-water { --nd-accent: #1e88e5; }
.nd-meter-check { --nd-accent: #78909c; }

/* Tank/equipment accent colors */
.nd-accent-oil-tank { --nd-accent: #43a047; }
.nd-accent-water-tank { --nd-accent: #1e88e5; }
.nd-accent-frac-tank { --nd-accent: #f9a825; }
.nd-accent-equipment { --nd-accent: #78909c; }

.nd-item-colliding {
  opacity: 0.6;
}
.nd-item-colliding circle:first-child,
.nd-item-colliding rect:first-child {
  stroke: #ef5350 !important;
  stroke-width: 3 !important;
}
.nd-shift-drag-outline {
  fill: none;
  stroke: #4a90e2;
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
  pointer-events: none;
}

/* Utility: hide elements (filter, toggle) */
.nd-hidden {
  display: none !important;
}

/* Product filter bar */
.product-filter-bar {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 15;
}

.product-filter-label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 4px;
}

.product-filter-pills {
  display: flex;
  gap: 8px;
}

.product-filter-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1.5px solid;
  border-radius: 16px;
  background: none;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.product-filter-pill.active[data-product="1"] {
  background: rgba(67, 160, 71, 0.1);
  border-color: #43a047;
  color: #2e7d32;
}

.product-filter-pill.active[data-product="3"] {
  background: rgba(229, 57, 53, 0.1);
  border-color: #e53935;
  color: #c62828;
}

.product-filter-pill.active[data-product="2"] {
  background: rgba(30, 136, 229, 0.1);
  border-color: #1e88e5;
  color: #1565c0;
}

.product-filter-pill.active[data-product="6"] {
  background: rgba(249, 168, 37, 0.1);
  border-color: #f9a825;
  color: #f57c00;
}

.product-filter-pill.inactive {
  background: #f5f5f5;
  border-color: #d0d0d0;
  color: #9e9e9e;
}

.product-filter-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}

.product-filter-pill.active .product-filter-dot {
  opacity: 1;
}

.product-filter-pill.inactive .product-filter-dot {
  opacity: 0.25;
  background-color: #9e9e9e !important;
}

.product-filter-pill:hover {
  transform: scale(1.05);
}

/* Hover cursor for movable nodes */
.nd-cursor-move {
  cursor: move;
}

/* In selectMove mode, all draggable elements show grab cursor on hover */
.nd-svg:not(.mode-box-select) .nd-node:hover,
.nd-svg:not(.mode-box-select) .nd-meter-node:hover,
.nd-svg:not(.mode-box-select) .nd-item-tile-node:hover,
.nd-svg:not(.mode-box-select) .nd-group-summary-node:hover {
  cursor: grab;
}

/* When actively dragging, show grabbing cursor */
.nd-svg:not(.mode-box-select) .nd-node:active,
.nd-svg:not(.mode-box-select) .nd-meter-node:active,
.nd-svg:not(.mode-box-select) .nd-item-tile-node:active,
.nd-svg:not(.mode-box-select) .nd-group-summary-node:active {
  cursor: grabbing;
}

/* Dashed selection ring - added via JS when dragging */
.nd-selection-ring {
  pointer-events: none;
}

/* Sidebar empty state */
.nd-sidebar-empty {
  padding: 20px 12px;
  color: #6b7280;
  font-size: 12px;
  text-transform: none;
  letter-spacing: normal;
}

/* Error state children */
.nd-error-icon {
  font-size: 24px;
  margin-bottom: 8px;
}
.nd-error-detail {
  font-size: 12px;
  margin-top: 8px;
  color: #6c757d;
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
  /* Hide everything except print container */
  body > *:not(.nd-print-container) {
    display: none !important;
  }

  /* Hide entire app container and navbar */
  .nd-container,
  nav,
  .navbar,
  #navbar,
  header,
  #app,
  .app,
  main {
    display: none !important;
  }

  /* Remove all page margins and ensure no blank pages */
  * {
    margin: 0 !important;
    padding: 0 !important;
  }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    width: 100% !important;
  }

  /* Prevent body from creating extra pages */
  body::before,
  body::after {
    display: none !important;
    content: none !important;
  }

  /* Hide app chrome (additional safeguard) */
  .nd-ribbon,
  .nd-controls,
  .nd-sidebar,
  .nd-canvas-wrapper {
    display: none !important;
  }

  /* Hide modals, overlays, notifications, and error messages */
  .modal,
  .modal-backdrop,
  .overlay,
  .toast,
  .notification,
  .alert,
  [role="dialog"],
  [role="alertdialog"] {
    display: none !important;
  }

  /* Show print container - start at very top */
  .nd-print-container {
    display: block !important;
    position: relative;
    width: 100%;
    background: white;
    margin: 0;
    padding: 0;
  }

  /* Ensure body doesn't hide content or add space */
  body {
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* First page starts immediately - no margin or padding */
  .nd-print-page:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  /* Page setup - US Letter landscape */
  @page {
    size: letter landscape;
    margin: 0.4in;
  }

  /* Print page - constrain to single page */
  .nd-print-page {
    page-break-after: always;
    page-break-inside: avoid;
    page-break-before: avoid;
    width: 100%;
    max-height: 7.5in;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  .nd-print-page:first-child {
    page-break-before: avoid !important;
  }

  .nd-print-page:last-child {
    page-break-after: auto;
  }

  /* Header - compact */
  .nd-print-header {
    border-bottom: 1px solid #333;
    padding-bottom: 4px;
    margin-bottom: 8px;
    flex-shrink: 0;
  }

  .nd-print-header-row {
    display: flex;
    justify-content: space-between;
    font-size: 9pt;
    margin-bottom: 2px;
  }

  .nd-print-title {
    font-weight: bold;
    font-size: 10pt;
  }

  /* Content - constrained to fit page */
  .nd-print-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 0;
    max-height: 6in;
  }

  /* SVG diagram in print - use most of the page (equipment is inside SVG now) */
  .nd-print-svg {
    width: 100%;
    flex-shrink: 0;
    max-width: 100%;
    max-height: 5.8in;
    height: auto;
  }

  /* Fallback text cards (if SVG rendering fails) */
  .nd-print-battery-card,
  .nd-print-well-card {
    border: 1px solid #666;
    border-radius: 4px;
    padding: 8px;
    width: 200px;
    margin: 8px;
  }

  .nd-print-card-header {
    font-size: 9pt;
    color: #666;
    margin-bottom: 4px;
  }

  .nd-print-card-name {
    font-weight: bold;
    font-size: 11pt;
  }

  .nd-print-items-list {
    margin-top: 8px;
    font-size: 9pt;
  }

  .nd-print-item {
    padding: 2px 0;
    color: #555;
  }

  /* Equipment section - below SVG diagram */
  .nd-print-equipment-section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #ddd;
    font-size: 8pt;
    max-height: 1.5in;
    overflow: hidden;
    width: 100%;
    flex-shrink: 1;
  }

  .nd-print-equipment-header {
    font-weight: bold;
    margin-bottom: 6px;
    color: #333;
  }

  .nd-print-equipment-stop {
    font-weight: 600;
    margin-top: 4px;
    margin-bottom: 2px;
    color: #555;
  }

  .nd-print-equipment-items {
    margin-left: 8px;
    margin-bottom: 4px;
  }

  .nd-print-equipment-item {
    padding: 1px 0;
    color: #666;
  }

  /* Footer - compact */
  .nd-print-footer {
    border-top: 1px solid #999;
    padding-top: 4px;
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    font-size: 8pt;
    color: #666;
    flex-shrink: 0;
  }
}

/* Hide print container when not printing */
@media screen {
  .nd-print-container {
    display: none;
  }
}

/* Well Test Tooltip (#48155) */
.nd-well-test-tooltip {
  position: absolute;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 14px;
  min-width: 240px;
  max-width: 280px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 12px;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.nd-well-test-tooltip.visible {
  opacity: 1;
}

.wt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.wt-title {
  font-size: 10px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wt-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.wt-badge-valid {
  background: #d1fae5;
  color: #065f46;
}

.wt-badge-invalid {
  background: #fee2e2;
  color: #991b1b;
}

.wt-date {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 12px;
}

.wt-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 10px 0;
}

.wt-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.wt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.wt-dot-oil {
  background: #43a047;
}

.wt-dot-gas {
  background: #e53935;
}

.wt-dot-water {
  background: #1e88e5;
}

.wt-dot-buyback {
  background: #f9a825;
}

.wt-label {
  font-size: 12px;
  color: #6b7280;
  min-width: 60px;
}

.wt-value {
  font-size: 12px;
  font-weight: 500;
  color: #1f2937;
  flex: 1;
  text-align: right;
}

.wt-missing {
  font-style: italic;
  color: #ef4444;
  font-size: 11px;
}

.wt-duration {
  font-size: 12px;
  color: #4b5563;
  margin-top: 4px;
}

.wt-footer {
  font-size: 11px;
  color: #6b7280;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f3f4f6;
}

/* Well Test Status Dot (on well cards) */
.nd-well-test-status {
  pointer-events: all;
}

.nd-well-test-status[data-hoverable="true"] {
  cursor: pointer;
}

.nd-well-test-status[data-hoverable="false"] {
  cursor: default;
  pointer-events: none;
}

.nd-well-test-status[data-hoverable="true"]:hover circle {
  filter: brightness(1.1);
  stroke: rgba(0,0,0,0.15);
  stroke-width: 1.5;
}
