/* ============================================
   PRIMOS Order Detail Full-Page Styles
   Full-page order detail view with two-column layout
   ============================================ */

/* ============================================
   FULL-PAGE CONTAINER
   ============================================ */

.order-detail-page {
  min-height: calc(100vh - 140px);
  background: #f5f6f8;
  padding: 0;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Back Navigation Bar */
.order-detail-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 100;
}

.order-detail-nav-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.order-detail-back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  color: #374151;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.order-detail-back-btn:hover {
  background: #e5e7eb;
  border-color: #d1d5db;
}

.order-detail-back-btn svg {
  width: 16px;
  height: 16px;
}

.order-detail-breadcrumb {
  font-size: 13px;
  color: #6b7280;
}

.order-detail-breadcrumb a {
  color: #6b7280;
  text-decoration: none;
}

.order-detail-breadcrumb a:hover {
  color: #8B1538;
  text-decoration: underline;
}

.order-detail-breadcrumb span {
  margin: 0 8px;
  color: #9ca3af;
}

.order-detail-nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-detail-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  border: 1px solid #e5e7eb;
  background: white;
  color: #374151;
}

.order-detail-action-btn:hover {
  border-color: #8B1538;
  color: #8B1538;
}

.order-detail-action-btn.primary {
  background: #8B1538;
  border-color: #8B1538;
  color: white;
}

.order-detail-action-btn.primary:hover {
  background: #6d1029;
  border-color: #6d1029;
}

/* ============================================
   PAGE HEADER - Compact Design
   ============================================ */

.order-detail-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%);
  color: white;
  padding: 16px 24px;
}

.order-detail-header.order-detail-header-compact {
  padding: 14px 24px 12px;
}

.order-detail-header-content {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.order-detail-header-left {
  flex: 1;
  min-width: 300px;
}

.order-detail-header-primary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.order-detail-header-sep {
  opacity: 0.5;
  font-size: 18px;
}

.order-detail-pd-number {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.order-detail-customer {
  font-size: 18px;
  font-weight: 600;
  opacity: 0.95;
}

.order-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  opacity: 0.8;
}

.order-detail-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.order-detail-meta-sep {
  opacity: 0.5;
  margin: 0 2px;
}

.order-detail-header-right {
  text-align: right;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Inline Badges */
.order-detail-badges {
  max-width: 1600px;
  margin: 12px auto 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.order-detail-badge-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
}

.order-detail-badge-item.highlight {
  background: rgba(139, 21, 56, 0.3);
  border: 1px solid rgba(139, 21, 56, 0.5);
}

.order-detail-badge-item.urgent {
  background: rgba(220, 38, 38, 0.3);
  border: 1px solid rgba(220, 38, 38, 0.5);
}

.order-detail-badge-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  opacity: 0.7;
}

.order-detail-badge-value {
  font-weight: 600;
}

.order-detail-badge-value.critical { color: #fca5a5; }
.order-detail-badge-value.warning { color: #fcd34d; }
.order-detail-badge-value.success { color: #86efac; }

.order-detail-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.order-detail-status-badge.critical { background: #dc2626; }
.order-detail-status-badge.behind { background: #f97316; }
.order-detail-status-badge.at-risk { background: #f59e0b; color: #1a1a1a; }
.order-detail-status-badge.on-track { background: #22c55e; }
.order-detail-status-badge.scheduled { background: #6b7280; }
.order-detail-status-badge.complete { background: #3b82f6; }

/* Fulcrum Sync Status Badge */
.order-detail-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 8px;
}

.order-detail-sync-badge.synced {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.order-detail-sync-badge.pending {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.order-detail-sync-badge.failed {
  background: rgba(220, 38, 38, 0.15);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.3);
}

.order-detail-sync-retry-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 3px;
  padding: 2px 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.order-detail-sync-retry-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.order-detail-sync-retry-btn svg {
  stroke: currentColor;
}

.order-detail-progress-text {
  font-size: 16px;
  opacity: 0.9;
  margin-bottom: 4px;
}

.order-detail-summary-blurb {
  font-size: 14px;
  opacity: 0.8;
  font-style: italic;
  max-width: 350px;
  margin-left: auto;
}

.order-detail-summary {
  font-size: 14px;
  max-width: 350px;
  margin-left: auto;
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
}

.order-detail-summary.summary-good {
  color: rgba(255, 255, 255, 0.9);
}

.order-detail-summary.summary-warning {
  background: rgba(245, 158, 11, 0.2);
  color: #fef3c7;
  font-weight: 500;
}

.order-detail-summary.summary-critical {
  background: rgba(220, 38, 38, 0.3);
  color: #fecaca;
  font-weight: 600;
}

/* ============================================
   QUICK INFO BAR (Legacy - kept for backward compatibility)
   ============================================ */

.order-detail-quick-info {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 16px 24px;
}

.order-detail-quick-info-inner {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: stretch;
}

.order-detail-chip {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 18px;
  min-width: 120px;
}

.order-detail-chip.highlight {
  border-color: #8B1538;
  background: #fef2f4;
}

.order-detail-chip.urgent {
  border-color: #dc2626;
  background: #fef2f2;
}

.order-detail-chip-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6b7280;
  margin-bottom: 4px;
}

.order-detail-chip-value {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a2e;
}

.order-detail-chip-value.critical { color: #dc2626; }
.order-detail-chip-value.warning { color: #f59e0b; }
.order-detail-chip-value.success { color: #22c55e; }

/* ============================================
   TWO-COLUMN LAYOUT
   ============================================ */

.order-detail-body {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

@media (max-width: 1200px) {
  .order-detail-body {
    grid-template-columns: 1fr;
  }
}

/* Left Column - Main Content */
.order-detail-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Right Column - Sidebar */
.order-detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ============================================
   SECTION CARDS
   ============================================ */

.order-detail-section {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  overflow: hidden;
}

.order-detail-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #fafbfc;
  border-bottom: 1px solid #e5e7eb;
}

.order-detail-section-title {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a2e;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.order-detail-section-title .count {
  background: #e5e7eb;
  color: #6b7280;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}

.order-detail-section-actions {
  display: flex;
  gap: 8px;
}

.order-detail-section-body {
  padding: 20px;
}

/* ============================================
   LINE ITEM CARDS (Enhanced for full-page)
   ============================================ */

.order-detail-line-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.order-detail-line-item {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  transition: all 0.2s ease;
}

.order-detail-line-item:hover {
  border-color: #d1d5db;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.order-detail-line-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: #fafbfc;
  border-bottom: 1px solid #eee;
}

.order-detail-line-item-title {
  flex: 1;
}

.order-detail-line-item-name {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 6px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.order-detail-line-item-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.order-detail-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.order-detail-badge.sku {
  background: #f0f0f0;
  color: #374151;
  font-family: 'SF Mono', 'Consolas', monospace;
}

.order-detail-badge.job {
  background: #e0e7ff;
  color: #4338ca;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-detail-badge.facility {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.order-detail-badge.facility.wpb {
  background: #dbeafe;
  color: #1e40af;
}

.order-detail-badge.facility.tus {
  background: #fef3c7;
  color: #92400e;
}

.order-detail-badge.missing {
  background: #fef2f2;
  color: #dc2626;
}

.order-detail-line-item-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.order-detail-progress-bar {
  width: 80px;
  height: 10px;
  background: #e5e7eb;
  border-radius: 5px;
  overflow: hidden;
}

.order-detail-progress-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.3s ease;
}

.order-detail-line-item-body {
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
}

.order-detail-field {
  font-size: 13px;
}

.order-detail-field-label {
  color: #6b7280;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.order-detail-field-value {
  color: #1a1a2e;
  font-weight: 500;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.order-detail-field-value.critical { color: #dc2626; }
.order-detail-field-value.warning { color: #f59e0b; }
.order-detail-field-value.success { color: #22c55e; }
.order-detail-field-value.muted { color: #9ca3af; font-style: italic; }

/* ============================================
   EMBROIDERY SECTION (within line items)
   ============================================ */

.order-detail-embroidery {
  padding: 16px 20px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.order-detail-embroidery-title {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.order-detail-embroidery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.order-detail-embroidery-item {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 10px 14px;
}

.order-detail-embroidery-item-label {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 4px;
}

.order-detail-embroidery-item-value {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a2e;
  font-family: 'SF Mono', 'Consolas', monospace;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.order-detail-thread-color {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  color: #6b7280;
}

.order-detail-thread-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.1);
}

/* ============================================
   UNITS EXPANSION (for multi-quantity)
   ============================================ */

.order-detail-units {
  padding: 16px 20px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

.order-detail-units-title {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 12px;
}

.order-detail-unit {
  display: flex;
  align-items: center;
  gap: 16px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 8px;
}

.order-detail-unit:last-child {
  margin-bottom: 0;
}

.order-detail-unit-position {
  font-weight: 600;
  color: #1a1a2e;
  min-width: 80px;
}

.order-detail-unit-embroidery {
  flex: 1;
  font-family: 'SF Mono', 'Consolas', monospace;
  color: #374151;
}

.order-detail-unit-status {
  font-size: 12px;
}

/* ============================================
   SIDEBAR CARDS
   ============================================ */

.order-detail-sidebar-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  overflow: hidden;
}

.order-detail-sidebar-card-header {
  padding: 14px 18px;
  background: #fafbfc;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px;
  font-weight: 600;
  color: #1a1a2e;
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-detail-sidebar-card-body {
  padding: 16px 18px;
}

/* Order Details Card */
.order-detail-info-grid {
  display: grid;
  gap: 14px;
}

.order-detail-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.order-detail-info-label {
  color: #6b7280;
}

.order-detail-info-value {
  font-weight: 500;
  color: #1a1a2e;
  text-align: right;
}

.order-detail-info-value a {
  color: #8B1538;
  text-decoration: none;
}

.order-detail-info-value a:hover {
  text-decoration: underline;
}

/* Notes Card */
.order-detail-notes {
  font-size: 13px;
  color: #374151;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.order-detail-notes.empty {
  color: #9ca3af;
  font-style: italic;
}

/* QuickBooks Card */
.order-detail-qb-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 14px;
}

.order-detail-qb-badge {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.order-detail-qb-badge.paid {
  background: #dcfce7;
  color: #166534;
}

.order-detail-qb-badge.sent {
  background: #dbeafe;
  color: #1e40af;
}

.order-detail-qb-badge.created {
  background: #e5e7eb;
  color: #374151;
}

.order-detail-qb-badge.overdue {
  background: #fef2f2;
  color: #dc2626;
}

.order-detail-qb-badge.none {
  background: #f3f4f6;
  color: #6b7280;
}

.order-detail-qb-info {
  flex: 1;
}

.order-detail-qb-number {
  font-weight: 600;
  color: #1a1a2e;
}

.order-detail-qb-detail {
  font-size: 12px;
  color: #6b7280;
}

.qb-overdue-days {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #dc2626;
  margin-top: 2px;
}

.order-detail-info-value.critical {
  color: #dc2626;
  font-weight: 600;
}

/* ============================================
   LOADING STATE
   ============================================ */

.order-detail-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: #6b7280;
}

.order-detail-loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e5e7eb;
  border-top-color: #8B1538;
  border-radius: 50%;
  animation: order-detail-spin 1s linear infinite;
  margin-bottom: 16px;
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ============================================
   MATTRESS-BEDDING GROUPING
   ============================================ */

.mattress-bedding-group {
  margin-bottom: 0;
}

.mattress-bedding-group:last-child {
  margin-bottom: 0;
}

.nested-bedding-section {
  margin: 0;
  padding: 0;
  border-left: none;
}

.bedding-collapsible {
  background: #fafafa;
  border: none;
  border-top: 1px solid #e5e7eb;
  border-radius: 0;
  overflow: hidden;
}

.bedding-collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #78716c;
  background: #f5f5f4;
  user-select: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bedding-collapsible-header:hover {
  background: #e7e5e4;
}

.bedding-collapsible[open] .bedding-collapsible-header {
  border-bottom: 1px solid #e5e7eb;
}

.bedding-count {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bedding-count::before {
  content: '▶';
  font-size: 8px;
  transition: transform 0.2s ease;
}

.bedding-collapsible[open] .bedding-count::before {
  transform: rotate(90deg);
}

.bedding-facility-badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.bedding-facility-badge.tus {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.nested-bedding-items {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.nested-bedding-item {
  display: flex;
  flex-direction: column;
  padding: 0;
  background: white;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
}

.nested-bedding-item:last-child {
  border-bottom: none;
}

.nested-bedding-item:hover {
  background: #fafafa;
}

.nested-bedding-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
}

.nested-bedding-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nested-bedding-sku {
  font-size: 11px;
  font-weight: 600;
  color: #6366f1;
  background: #eef2ff;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Consolas', monospace;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.nested-bedding-name {
  font-weight: 500;
  color: #1a1a2e;
  font-size: 13px;
}

.nested-bedding-qty {
  font-size: 12px;
  color: #78716c;
  font-weight: 500;
}

.nested-bedding-embroidery {
  font-size: 11px;
  color: #8B1538;
  background: #fef2f4;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Consolas', monospace;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nested-bedding-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.nested-bedding-progress {
  width: 50px;
  height: 5px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
}

.nested-bedding-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Bedding configuration details */
.nested-bedding-config {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 20px 12px 20px;
  margin-top: -4px;
}

.config-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 8px;
  background: #f3f4f6;
  border-radius: 4px;
  color: #4b5563;
}

.config-tag.highlight {
  background: #ede9fe;
  color: #7c3aed;
  font-weight: 500;
}

.config-tag .config-label {
  color: #9ca3af;
  font-weight: 400;
}

.config-tag.highlight .config-label {
  color: #a78bfa;
}

.order-detail-loading-text {
  font-size: 15px;
}

/* ============================================
   ERROR STATE
   ============================================ */

.order-detail-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
}

.order-detail-error-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.order-detail-error-title {
  font-size: 18px;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 8px;
}

.order-detail-error-message {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 20px;
}

/* ============================================
   JOBS TABLE SECTION
   ============================================ */

.order-detail-jobs-table-wrapper {
  overflow-x: auto;
}

.order-detail-jobs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.order-detail-jobs-table thead {
  background: #fafbfc;
  border-bottom: 1px solid #e5e7eb;
}

.order-detail-jobs-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #6b7280;
  white-space: nowrap;
}

.order-detail-jobs-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
  vertical-align: middle;
}

.order-detail-job-row:last-child td {
  border-bottom: none;
}

.order-detail-job-row:hover {
  background: #f9fafb;
}

.order-detail-job-row.active-worker {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.08) 0%, transparent 100%);
}

.order-detail-job-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #8B1538;
  font-weight: 600;
  text-decoration: none;
  font-family: 'SF Mono', 'Consolas', monospace;
}

.order-detail-job-link:hover {
  text-decoration: underline;
}

.active-worker-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse-worker 2s infinite;
}

@keyframes pulse-worker {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.2);
  }
}

.order-detail-job-product {
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-detail-job-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.order-detail-job-status.scheduled {
  background: #f3f4f6;
  color: #6b7280;
}

.order-detail-job-status.in-progress {
  background: #dbeafe;
  color: #1e40af;
}

.order-detail-job-status.complete {
  background: #dcfce7;
  color: #166534;
}

.order-detail-job-hours {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 12px;
}

.order-detail-job-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-detail-job-progress-bar {
  width: 60px;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.order-detail-job-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.order-detail-job-progress-text {
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
  min-width: 32px;
}

.due-countdown {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
}

.critical .due-countdown,
td.critical .due-countdown {
  color: #dc2626;
}

.warning .due-countdown,
td.warning .due-countdown {
  color: #f59e0b;
}

td.critical {
  color: #dc2626;
  font-weight: 600;
}

td.warning {
  color: #f59e0b;
  font-weight: 500;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
  .order-detail-header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .order-detail-header-right {
    text-align: left;
  }

  .order-detail-header-primary {
    flex-direction: column;
    gap: 2px;
  }

  .order-detail-header-sep {
    display: none;
  }

  .order-detail-pd-number {
    font-size: 24px;
  }

  .order-detail-customer {
    font-size: 16px;
  }

  .order-detail-badges {
    gap: 6px;
  }

  .order-detail-badge-item {
    padding: 5px 10px;
    font-size: 12px;
  }

  .order-detail-body {
    padding: 16px;
  }

  .order-detail-line-item-body {
    grid-template-columns: repeat(2, 1fr);
  }

  .order-detail-nav {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .order-detail-nav-right {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  /* Jobs table responsive */
  .order-detail-jobs-table {
    font-size: 12px;
  }

  .order-detail-jobs-table th,
  .order-detail-jobs-table td {
    padding: 10px 12px;
  }

  .order-detail-jobs-table th:nth-child(4),
  .order-detail-jobs-table td:nth-child(4),
  .order-detail-jobs-table th:nth-child(5),
  .order-detail-jobs-table td:nth-child(5) {
    display: none;
  }

  .order-detail-job-product {
    max-width: 150px;
  }

  .order-detail-job-progress-bar {
    width: 40px;
  }
}

/* ============================================
   ENGINEERING SECTION (Compact Design)
   Single block with header, source pills, and dates
   ============================================ */

.order-eng-block {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

.order-eng-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: linear-gradient(to right, #f1f5f9, #f8fafc);
  border-bottom: 1px solid #e2e8f0;
}

.order-eng-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.order-eng-title svg {
  color: #64748b;
}

/* Status Pills in Header */
.eng-status-pill {
  font-size: 9px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.eng-status-pill.not-started { background: #f1f5f9; color: #64748b; }
.eng-status-pill.pending { background: #e0e7ff; color: #4338ca; }
.eng-status-pill.in-progress { background: #dbeafe; color: #1e40af; }
.eng-status-pill.overdue { background: #fef3c7; color: #92400e; }
.eng-status-pill.complete { background: #dcfce7; color: #166534; }

/* Open Engineering Button */
.order-eng-open-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: #4f46e5;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.order-eng-open-btn:hover {
  background: #4338ca;
}

/* Engineering Body */
.order-eng-body {
  padding: 12px 20px 14px;
}

/* Source Row */
.order-eng-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.order-eng-label {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  min-width: 45px;
}

/* Source Pills - Compact Horizontal */
.order-eng-source-pills {
  display: flex;
  gap: 5px;
}

.eng-pill {
  padding: 5px 10px;
  background: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.eng-pill:hover:not(:disabled) {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.eng-pill:disabled { cursor: default; }
.eng-pill:disabled:not(.active) { opacity: 0.4; }

.eng-pill.active.standard {
  background: var(--color-health-green);
  color: white;
  border-color: var(--color-health-green-border);
}

.eng-pill.active.no_scans {
  background: var(--color-health-red);
  color: white;
  border-color: var(--color-health-red-border);
}

.eng-pill.active.has_scans {
  background: var(--color-health-yellow);
  color: #1a1a1a;
  border-color: var(--color-health-yellow-border);
}

/* Dates Row - Compact Inline */
.order-eng-dates {
  display: flex;
  gap: 20px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}

.order-eng-date {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.order-eng-date .label {
  font-size: 9px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.order-eng-date .value {
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.order-eng-date .value.overdue { color: #dc2626; }
.order-eng-date .value.complete { color: #16a34a; }

/* Dimensions - Compact */
.order-eng-dims {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
  font-size: 11px;
  color: #475569;
  font-weight: 500;
}
