/**
 * PT Cloud - Clean Modern Operations Template (Header & Nav Redesign)
 * Adhering to UI/UX Pro Max Guidelines
 * "สวยงาม สะอาดตา ทันสมัย สบายตา คมชัดระดับ Pro Max"
 * 
 * Features:
 * - High Contrast: Dark Circuit Data Stream Canvas vs Elevated Clean White Cards
 * - Fully Responsive Header: Fluid, beautiful, zero overlap/squeeze across all devices (320px to 4K)
 * - WCAG 2.1 AA Accessibility: Contrast >= 4.5:1, Focus States, 44px Touch Targets
 * - Smooth 60FPS Micro-interactions & Zero Layout Shift
 */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&family=Prompt:wght@300;400;500;600;700&display=swap');

:root {
  /* High-Contrast Canvas: Deep Cyber Midnight */
  --pt-canvas-bg: #070b14;
  --pt-canvas-glow: #0d1a33;

  /* Card Surfaces: High-Contrast Crisp Clean White */
  --pt-surface-white: #ffffff;
  --pt-surface-subtle: #f8fafc;
  --pt-surface-hover: #f1f5f9;

  /* Refined Lines & Borders */
  --pt-border-clean: #e2e8f0;
  --pt-border-subtle: #f1f5f9;
  --pt-border-focus: #2563eb;

  /* Typography Colors (High Contrast >= 7:1) */
  --pt-text-dark: #0f172a;
  --pt-text-body: #334155;
  --pt-text-muted: #64748b;
  --pt-text-light: #94a3b8;

  /* Primary Brand & Accents */
  --pt-primary: #2563eb;
  --pt-primary-hover: #1d4ed8;
  --pt-primary-light: #eff6ff;
  --pt-primary-border: #bfdbfe;

  /* Semantic Status Colors (WCAG Compliant) */
  --pt-success: #10b981;
  --pt-success-light: #ecfdf5;
  --pt-success-border: #a7f3d0;
  --pt-success-text: #065f46;

  --pt-warning: #f59e0b;
  --pt-warning-light: #fffbeb;
  --pt-warning-border: #fde68a;
  --pt-warning-text: #92400e;

  --pt-danger: #ef4444;
  --pt-danger-light: #fef2f2;
  --pt-danger-border: #fee2e2;
  --pt-danger-text: #991b1b;

  --pt-purple: #8b5cf6;
  --pt-purple-light: #f5f3ff;
  --pt-purple-border: #ddd6fe;
  --pt-purple-text: #5b21b6;

  /* Deep Contrast Elevation Shadows (Cards float over dark canvas) */
  --pt-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.15);
  --pt-shadow-card: 0 10px 25px -4px rgba(0, 0, 0, 0.45), 0 4px 10px -2px rgba(0, 0, 0, 0.25);
  --pt-shadow-elevated: 0 20px 40px -6px rgba(0, 0, 0, 0.55), 0 8px 16px -4px rgba(0, 0, 0, 0.35);
  --pt-shadow-primary: 0 4px 14px rgba(37, 99, 235, 0.35);

  /* Typography Stacks */
  --pt-font-display: 'Prompt', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --pt-font-body: 'IBM Plex Sans Thai', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --pt-font-mono: 'JetBrains Mono', 'IBM Plex Sans Thai', Consolas, monospace;
  --pt-font-data: 'JetBrains Mono', 'IBM Plex Sans Thai', Consolas, 'Segoe UI', monospace;
}

/* Base Canvas Reset - Deep Cyber Space Backdrop */
html,
body {
  background-color: var(--pt-canvas-bg) !important;
  background-image: radial-gradient(circle at 50% 0%, var(--pt-canvas-glow) 0%, var(--pt-canvas-bg) 75%) !important;
  color: var(--pt-text-body) !important;
  font-family: var(--pt-font-body) !important;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip !important;
}

/* High-Tech Circuit Canvas in the Background */
.circuit-canvas,
#circuitCanvas {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 0 !important;
  pointer-events: none !important;
  display: block !important;
}

/* Layout Shell */
.dashboard-container {
  min-height: 100vh;
  background-color: transparent !important;
  position: relative;
  z-index: 1;
  overflow: visible !important;
}

.container {
  max-width: 1800px;
  margin: 0 auto;
  padding: 0 20px 32px 20px !important;
  position: relative;
  z-index: 2;
}

.dashboard-grid {
  display: grid !important;
  grid-template-columns: 260px 1fr !important;
  gap: 22px !important;
  margin-top: 18px !important;
  align-items: stretch !important;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    display: block !important;
    margin-top: 14px !important;
  }
}

/* ==========================================================================
   Header Topbar (ส่วน Header สวยงาม คมชัด รองรับทุกหน้าจอ)
   ========================================================================== */

.pt-header,
header.pt-header,
header.header {
  background: var(--pt-surface-white) !important;
  border: 1px solid rgba(226, 232, 240, 0.95) !important;
  border-radius: 16px !important;
  box-shadow: var(--pt-shadow-card) !important;
  margin-top: 14px !important;
  margin-bottom: 18px !important;
  position: sticky !important;
  top: 14px !important;
  z-index: 1000 !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  transition: box-shadow 0.2s ease, transform 0.2s ease !important;
}

.pt-header-container {
  max-width: 1800px;
  margin: 0 auto;
  padding: 10px 22px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  min-height: 64px !important;
  height: auto !important;
  box-sizing: border-box !important;
  gap: 12px 18px !important;
}

/* Left: Logo & Brand */
.pt-header-left {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  flex-shrink: 0 !important;
}

.pt-logo {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  text-decoration: none !important;
  color: var(--pt-text-dark) !important;
  cursor: pointer !important;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  user-select: none !important;
}

.pt-logo:hover {
  transform: translateY(-1px) !important;
}

.pt-logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.pt-logo-icon svg {
  width: 22px;
  height: 22px;
  stroke: #ffffff;
  fill: none;
}

.pt-logo-text {
  display: flex;
  flex-direction: column;
}

.pt-logo-title {
  font-family: var(--pt-font-display) !important;
  font-weight: 700 !important;
  font-size: 1.25rem !important;
  color: var(--pt-text-dark) !important;
  letter-spacing: -0.01em !important;
  line-height: 1.15 !important;
}

.pt-logo-tag {
  font-family: var(--pt-font-mono) !important;
  font-size: 0.64rem !important;
  font-weight: 700 !important;
  color: var(--pt-primary) !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
}

/* Center: Real-time Telemetry & Live Clock */
.pt-header-center {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 12px !important;
  flex: 1 1 auto !important;
}

.pt-time {
  background: var(--pt-surface-subtle) !important;
  border: 1px solid var(--pt-border-clean) !important;
  padding: 6px 16px !important;
  border-radius: 9999px !important;
  display: flex !important;
  align-items: center !important;
  gap: 9px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03) !important;
  white-space: nowrap !important;
}

.pt-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--pt-success);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
  display: inline-block;
  animation: pt-pulse 2s infinite;
  flex-shrink: 0;
}

@keyframes pt-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.pt-time svg {
  color: var(--pt-primary) !important;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

#systemTime {
  font-family: var(--pt-font-mono) !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  color: var(--pt-text-dark) !important;
  letter-spacing: 0.02em !important;
}

#systemDate {
  font-family: var(--pt-font-body) !important;
  font-size: 0.85rem !important;
  color: var(--pt-text-muted) !important;
  border-left: 1px solid #cbd5e1;
  padding-left: 9px;
  margin-left: 2px;
}

/* Right: Notification, Profile, Logout */
.pt-header-right {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  flex-shrink: 0 !important;
}

/* Notification Button (44x44px Touch Target per UI/UX Pro Max) */
.pt-notification-btn {
  width: 42px !important;
  height: 42px !important;
  border-radius: 11px !important;
  border: 1px solid var(--pt-border-clean) !important;
  background: var(--pt-surface-white) !important;
  color: var(--pt-text-muted) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  position: relative !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  outline: none !important;
  flex-shrink: 0 !important;
}

.pt-notification-btn:focus-visible {
  outline: 2px solid var(--pt-primary) !important;
  outline-offset: 2px !important;
}

.pt-notification-btn:hover {
  background: var(--pt-surface-hover) !important;
  color: var(--pt-primary) !important;
  border-color: #cbd5e1 !important;
  transform: translateY(-1px) !important;
}

.pt-notification-badge {
  position: absolute !important;
  top: 8px !important;
  right: 8px !important;
  width: 8px !important;
  height: 8px !important;
  background: var(--pt-danger) !important;
  border-radius: 50% !important;
  border: 2px solid #ffffff !important;
}

/* User Profile Trigger Pill */
.pt-user-profile {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 4px 12px 4px 5px !important;
  background: var(--pt-surface-white) !important;
  border: 1px solid var(--pt-border-clean) !important;
  border-radius: 9999px !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
  outline: none !important;
  user-select: none !important;
  flex-shrink: 0 !important;
}

.pt-user-profile:focus-visible {
  outline: 2px solid var(--pt-primary) !important;
  outline-offset: 2px !important;
}

.pt-user-profile:hover {
  background: var(--pt-surface-hover) !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08) !important;
  transform: translateY(-1px) !important;
}

.pt-avatar {
  width: 34px !important;
  height: 34px !important;
  border-radius: 50% !important;
  overflow: hidden !important;
  border: 1.5px solid var(--pt-border-clean) !important;
  background: #f1f5f9 !important;
  flex-shrink: 0 !important;
}

.pt-avatar img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

.pt-user-info {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  line-height: 1.15 !important;
}

.pt-username {
  font-family: var(--pt-font-display) !important;
  font-size: 0.86rem !important;
  font-weight: 600 !important;
  color: var(--pt-text-dark) !important;
  white-space: nowrap !important;
}

/* Role Badges with Clean Semantic Colors */
.pt-user-role {
  font-family: var(--pt-font-mono) !important;
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  padding: 1px 7px !important;
  border-radius: 9999px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  display: inline-block !important;
  margin-top: 2px !important;
  white-space: nowrap !important;
}

.pt-user-role.role-admin {
  background: var(--pt-purple-light) !important;
  color: var(--pt-purple-text) !important;
  border: 1px solid var(--pt-purple-border) !important;
}

.pt-user-role.role-manager {
  background: var(--pt-primary-light) !important;
  color: var(--pt-primary-hover) !important;
  border: 1px solid var(--pt-primary-border) !important;
}

.pt-user-role.role-qc {
  background: var(--pt-warning-light) !important;
  color: var(--pt-warning-text) !important;
  border: 1px solid var(--pt-warning-border) !important;
}

.pt-user-role.role-sale {
  background: var(--pt-success-light) !important;
  color: var(--pt-success-text) !important;
  border: 1px solid var(--pt-success-border) !important;
}

.pt-user-role.role-user {
  background: var(--pt-surface-subtle) !important;
  color: var(--pt-text-body) !important;
  border: 1px solid var(--pt-border-clean) !important;
}

/* Logout Button */
.pt-logout-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 8px 15px !important;
  border-radius: 10px !important;
  background: var(--pt-danger-light) !important;
  border: 1px solid var(--pt-danger-border) !important;
  color: #dc2626 !important;
  font-family: var(--pt-font-display) !important;
  font-size: 0.84rem !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  cursor: pointer !important;
  outline: none !important;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

.pt-logout-btn:focus-visible {
  outline: 2px solid #dc2626 !important;
  outline-offset: 2px !important;
}

.pt-logout-btn:hover {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3) !important;
  transform: translateY(-1px) !important;
}

.pt-logout-btn svg {
  width: 15px !important;
  height: 15px !important;
}

/* ==========================================================================
   Header Responsive Breakpoints (ป้องกันการบีบพื้นที่หรือทับซ้อนกันในทุกหน้าจอ)
   ========================================================================== */

/* 1. Laptops & Medium Screens (992px to 1199px) */
@media (max-width: 1199px) {
  .pt-header-container {
    padding: 8px 18px !important;
    gap: 10px 14px !important;
  }

  .pt-logo-tag {
    display: none !important;
    /* Hide tiny tagline to save space */
  }

  #systemDate {
    display: none !important;
    /* Hide date on medium widths to keep clock clean */
  }

  .pt-username {
    max-width: 115px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

/* 2. Tablets & Small Laptops (769px to 991px) */
@media (max-width: 991px) {
  .pt-header-container {
    padding: 8px 14px !important;
    gap: 8px 10px !important;
  }

  .pt-logo-icon {
    width: 36px !important;
    height: 36px !important;
  }

  .pt-logo-title {
    font-size: 1.15rem !important;
  }

  .pt-logo-tag {
    display: none !important;
  }

  #systemDate {
    display: none !important;
  }

  .pt-time {
    padding: 5px 12px !important;
    font-size: 0.88rem !important;
  }

  .pt-user-role {
    display: none !important;
    /* Hide role badge to prevent squeezing */
  }

  .pt-username {
    max-width: 95px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Compact icon-only Logout button (saves ~75px of width) */
  .pt-logout-btn span {
    display: none !important;
  }

  .pt-logout-btn {
    padding: 9px !important;
    min-width: 38px !important;
    height: 38px !important;
    justify-content: center !important;
  }
}

/* 3. Mobile & Shop-Floor Touch Screens (<= 768px) */
@media (max-width: 768px) {
  .pt-header {
    margin-top: 8px !important;
    margin-bottom: 14px !important;
    border-radius: 14px !important;
    top: 8px !important;
  }

  .pt-header-container {
    padding: 10px 14px 8px 14px !important;
    flex-wrap: wrap !important;
    /* Fluid 2-Tier layout: NEVER overlaps or squashes */
    gap: 8px 10px !important;
    min-height: auto !important;
  }

  /* Row 1: Left Brand */
  .pt-header-left {
    order: 1 !important;
    flex: 0 1 auto !important;
  }

  .pt-logo-icon {
    width: 34px !important;
    height: 34px !important;
  }

  .pt-logo-title {
    font-size: 1.1rem !important;
  }

  .pt-logo-tag {
    display: none !important;
  }

  /* Row 1: Right Controls */
  .pt-header-right {
    order: 2 !important;
    margin-left: auto !important;
    gap: 8px !important;
  }

  .pt-notification-btn {
    width: 36px !important;
    height: 36px !important;
  }

  .pt-user-profile {
    padding: 3px 8px 3px 4px !important;
    gap: 6px !important;
  }

  .pt-avatar {
    width: 28px !important;
    height: 28px !important;
  }

  .pt-user-role {
    display: none !important;
  }

  .pt-username {
    font-size: 0.8rem !important;
    max-width: 75px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .pt-logout-btn {
    padding: 8px !important;
    min-width: 36px !important;
    height: 36px !important;
    justify-content: center !important;
  }

  .pt-logout-btn span {
    display: none !important;
  }

  /* Row 2: Live Time Capsule (Centered on dedicated row with generous space) */
  .pt-header-center {
    order: 3 !important;
    width: 100% !important;
    justify-content: center !important;
    margin-top: 4px !important;
    padding-top: 6px !important;
    border-top: 1px solid #f1f5f9 !important;
  }

  .pt-time {
    padding: 4px 14px !important;
    font-size: 0.85rem !important;
    background: #f8fafc !important;
  }

  #systemDate {
    display: inline-block !important;
    /* Full width on Row 2 allows showing full date cleanly */
    font-size: 0.78rem !important;
  }
}

/* 4. Extra Small Mobile (<= 380px) */
@media (max-width: 380px) {
  .pt-header-container {
    padding: 8px 10px !important;
  }

  .pt-username {
    display: none !important;
    /* Show avatar icon only on ultra-compact screens */
  }

  .pt-user-profile {
    padding: 3px !important;
  }
}

/* ==========================================================================
   Navigation Sidebar (ส่วน Nav ออกแบบตามหลัก UI/UX Pro Max)
   ========================================================================== */

.sidebar {
  width: 100% !important;
  position: -webkit-sticky !important;
  position: sticky !important;
  top: 104px !important;
  align-self: start !important;
  z-index: 90 !important;
  max-height: calc(100vh - 120px) !important;
  display: flex !important;
  flex-direction: column !important;
  transition: top 0.2s ease !important;
}

.sidebar .card {
  background: var(--pt-surface-white) !important;
  border: 1px solid rgba(226, 232, 240, 0.95) !important;
  border-radius: 16px !important;
  box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.12), 0 4px 10px -2px rgba(0, 0, 0, 0.05) !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  max-height: 100% !important;
  height: auto !important;
  position: relative !important;
}

/* Gradient Vignette / Feather Overlay for Smooth Fade-Away Effect */
.sidebar .card::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: 22px !important;
  background: linear-gradient(to bottom, #ffffff 15%, rgba(255, 255, 255, 0) 100%) !important;
  pointer-events: none !important;
  z-index: 10 !important;
  border-top-left-radius: 16px !important;
  border-top-right-radius: 16px !important;
}

.sidebar .card::after {
  content: '' !important;
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: 26px !important;
  background: linear-gradient(to top, #ffffff 15%, rgba(255, 255, 255, 0) 100%) !important;
  pointer-events: none !important;
  z-index: 10 !important;
  border-bottom-left-radius: 16px !important;
  border-bottom-right-radius: 16px !important;
}

.sidebar .card-content {
  padding: 14px 12px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scrollbar-width: thin !important;
  scrollbar-color: #cbd5e1 transparent !important;
  overscroll-behavior: contain !important;
  scroll-behavior: smooth !important;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 20px, black calc(100% - 22px), transparent 100%) !important;
  mask-image: linear-gradient(to bottom, transparent 0%, black 20px, black calc(100% - 22px), transparent 100%) !important;
}

.sidebar .card-content::-webkit-scrollbar {
  width: 5px;
}

.sidebar .card-content::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar .card-content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.sidebar .card-content::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.sidebar-nav {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
}

/* Section Group Headings with Micro-Indicator */
.nav-group-heading {
  font-family: var(--pt-font-display) !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  color: #64748b !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  padding: 14px 12px 6px 12px !important;
  border-top: 1px solid var(--pt-border-subtle) !important;
  margin-top: 6px !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.nav-group-heading::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: #cbd5e1;
}

.nav-group-heading:first-child {
  border-top: none !important;
  margin-top: 0 !important;
  padding-top: 4px !important;
}

/* Nav Item Button (Min 44px Touch Target per UI/UX Pro Max Priority 2) */
.nav-item {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  width: 100% !important;
  min-height: 44px !important;
  padding: 10px 14px !important;
  border-radius: 11px !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  color: var(--pt-text-body) !important;
  font-family: var(--pt-font-display) !important;
  font-size: 0.92rem !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  text-align: left !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  position: relative !important;
  outline: none !important;
  box-sizing: border-box !important;
  user-select: none !important;
}

/* Visible Keyboard Focus Ring (Priority 1: Accessibility) */
.nav-item:focus-visible {
  outline: 2px solid var(--pt-primary) !important;
  outline-offset: 2px !important;
}

.nav-item svg {
  width: 19px !important;
  height: 19px !important;
  color: var(--pt-text-muted) !important;
  stroke: var(--pt-text-muted) !important;
  stroke-width: 1.8px !important;
  flex-shrink: 0 !important;
  transition: all 0.2s ease !important;
}

/* Hover State */
.nav-item:hover {
  background: var(--pt-surface-hover) !important;
  color: var(--pt-text-dark) !important;
  transform: translateX(4px) !important;
}

.nav-item:hover svg {
  color: var(--pt-primary) !important;
  stroke: var(--pt-primary) !important;
}

/* Active State - Crisp Royal Blue Fill with subtle glow & indicator */
.nav-item.active {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  box-shadow: var(--pt-shadow-primary) !important;
  border-color: transparent !important;
  transform: none !important;
}

.nav-item.active svg {
  color: #ffffff !important;
  stroke: #ffffff !important;
  stroke-width: 2px !important;
}

/* Active Right Indicator Dot */
.nav-item.active::after {
  content: '';
  position: absolute;
  right: 12px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

/* ==========================================================================
   Mobile & Tablet Navigation Drawer (Responsive Off-Canvas System)
   Prevents sidebar from covering page content on mobile and tablet devices
   ========================================================================== */

/* 1. Mobile Menu Toggle Button (in Header) */
.pt-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 10px !important;
  color: #1e293b !important;
  cursor: pointer !important;
  padding: 0 !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
}

.pt-menu-toggle:hover {
  background: #e2e8f0 !important;
  color: var(--pt-primary) !important;
  border-color: var(--pt-primary) !important;
}

.pt-menu-toggle:focus-visible {
  outline: 2px solid var(--pt-primary) !important;
  outline-offset: 2px !important;
}

/* 2. Mobile Header inside Sidebar */
.sidebar-mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.sidebar-mobile-title {
  font-family: var(--pt-font-display);
  font-size: 0.94rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-mobile-title svg {
  color: var(--pt-primary);
}

.sidebar-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #64748b;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-close-btn:hover {
  color: #ef4444;
  background: #fef2f2;
  border-color: #fecaca;
}

/* 3. Backdrop for Mobile Drawer */
.pt-sidebar-backdrop {
  display: none;
}

/* ==========================================================================
   Responsive Breakpoint for Mobile & Tablet (<= 1024px)
   ========================================================================== */
@media (max-width: 1024px) {

  /* Show Menu Toggle in Header */
  .pt-menu-toggle {
    display: inline-flex !important;
  }

  /* 1-Column Layout: Main Content Takes Full Width */
  .dashboard-grid {
    display: block !important;
    margin-top: 14px !important;
  }

  /* Transform Sidebar into an Off-Canvas Slide-Out Drawer (Never covers page content) */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 290px !important;
    max-width: 85vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    z-index: 10001 !important;
    transform: translateX(-105%) !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    margin: 0 !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45) !important;
    background: transparent !important;
    display: block !important;
  }

  /* When Drawer is Open */
  body.sidebar-open .sidebar {
    transform: translateX(0) !important;
  }

  /* Mobile Drawer Card Styling */
  .sidebar .card {
    border-radius: 0 18px 18px 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    border-left: none !important;
    border-top: none !important;
    border-bottom: none !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .sidebar-mobile-header {
    display: flex !important;
  }

  .sidebar .card-content {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 12px 14px 24px 14px !important;
    max-height: calc(100vh - 65px) !important;
  }

  /* Dimmed Backdrop when Drawer is Open */
  .pt-sidebar-backdrop {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(7, 11, 20, 0.72) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    z-index: 10000 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.25s ease !important;
  }

  body.sidebar-open .pt-sidebar-backdrop {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  body.sidebar-open {
    overflow: hidden !important;
  }
}

/* ==========================================================================
   Clean Profile Modal (หน้าต่างโปรไฟล์ สวยงาม สะอาดตา)
   ========================================================================== */

.pt-profile-modal {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(7, 11, 20, 0.65) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  z-index: 2147483647 !important;
}

.pt-profile-modal.open {
  display: flex !important;
}

.pt-profile-modal-dialog {
  width: min(580px, 100%) !important;
  background: var(--pt-surface-white) !important;
  border: 1px solid var(--pt-border-clean) !important;
  border-radius: 20px !important;
  box-shadow: var(--pt-shadow-elevated) !important;
  overflow: hidden !important;
  animation: pt-modal-in 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@keyframes pt-modal-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.pt-profile-modal-header {
  padding: 18px 24px !important;
  background: #f8fafc !important;
  border-bottom: 1px solid var(--pt-border-clean) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
}

.pt-profile-modal-header h3 {
  font-family: var(--pt-font-display) !important;
  font-size: 1.15rem !important;
  font-weight: 700 !important;
  color: var(--pt-text-dark) !important;
  margin: 0 !important;
}

.pt-profile-close {
  background: transparent !important;
  border: none !important;
  font-size: 24px !important;
  color: var(--pt-text-light) !important;
  cursor: pointer !important;
  line-height: 1 !important;
  transition: color 0.2s ease !important;
}

.pt-profile-close:hover {
  color: var(--pt-danger) !important;
}

.pt-profile-modal form {
  padding: 24px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
}

.pt-profile-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 16px !important;
}

@media (max-width: 600px) {
  .pt-profile-grid {
    grid-template-columns: 1fr !important;
  }
}

.pt-profile-field {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  color: var(--pt-text-dark) !important;
}

.pt-profile-field input {
  width: 100% !important;
  padding: 10px 14px !important;
  background: var(--pt-surface-white) !important;
  border: 1px solid var(--pt-border-clean) !important;
  border-radius: 10px !important;
  font-family: var(--pt-font-body) !important;
  font-size: 0.95rem !important;
  color: var(--pt-text-dark) !important;
  box-sizing: border-box !important;
  outline: none !important;
  transition: all 0.2s ease !important;
}

.pt-profile-field input:focus {
  border-color: var(--pt-primary) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

.pt-profile-field input[readonly] {
  background: var(--pt-surface-subtle) !important;
  color: var(--pt-text-muted) !important;
  cursor: not-allowed !important;
}

.pt-profile-actions {
  display: flex !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  margin-top: 12px !important;
  padding-top: 16px !important;
  border-top: 1px solid var(--pt-border-subtle) !important;
}

.pt-profile-cancel {
  padding: 9px 18px !important;
  border-radius: 9px !important;
  border: 1px solid var(--pt-border-clean) !important;
  background: var(--pt-surface-white) !important;
  color: var(--pt-text-body) !important;
  font-family: var(--pt-font-display) !important;
  font-weight: 600 !important;
  font-size: 0.92rem !important;
  cursor: pointer !important;
}

.pt-profile-cancel:hover {
  background: var(--pt-surface-subtle) !important;
}

.pt-profile-save {
  padding: 9px 22px !important;
  border-radius: 9px !important;
  border: none !important;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  color: #ffffff !important;
  font-family: var(--pt-font-display) !important;
  font-weight: 600 !important;
  font-size: 0.92rem !important;
  cursor: pointer !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3) !important;
}

.pt-profile-save:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%) !important;
}

.pt-profile-save:disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
}

/* ==========================================================================
   Clean Card System for Content Area (High Contrast Floating Panels)
   ========================================================================== */

.card {
  background: var(--pt-surface-white) !important;
  border: 1px solid rgba(226, 232, 240, 0.95) !important;
  border-radius: 16px !important;
  box-shadow: var(--pt-shadow-card) !important;
  overflow: hidden;
}

.card-header {
  padding: 16px 20px !important;
  background: var(--pt-surface-white) !important;
  border-bottom: 1px solid var(--pt-border-clean) !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-family: var(--pt-font-display) !important;
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  color: var(--pt-text-dark) !important;
  margin: 0 !important;
}

/*
.card-header svg {
  color: #07db34 !important;
}
*/
/* High-Readability Table Defaults inside Cards */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

thead th {
  background: #f8fafc !important;
  color: #475569 !important;
  font-family: var(--pt-font-display) !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  padding: 12px 14px !important;
  border-bottom: 1px solid var(--pt-border-clean) !important;
  text-align: left;
}

tbody td {
  padding: 12px 14px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  color: #1e293b !important;
  font-size: 0.92rem !important;
  background: #ffffff;
}

tbody tr:hover td {
  background: #f8fafc !important;
}

tbody tr:last-child td {
  border-bottom: none !important;
}

/* Smooth Spinner for Loading Overlay */
.loading-overlay {
  background-color: rgba(7, 11, 20, 0.85) !important;
  backdrop-filter: blur(10px) !important;
}

.loading-text {
  color: #38bdf8 !important;
  font-family: var(--pt-font-display) !important;
  font-weight: 700 !important;
}

/* ==========================================================================
   Modern Machine Status Overview Section (Smart Factory Real-time Tiles)
   Adhering to frontend-design & ui-ux-pro-max guidelines
   ========================================================================== */

/* Main System Overview Card */
.card.system-overview {
  background: var(--pt-surface-white) !important;
  border: 1px solid rgba(226, 232, 240, 0.95) !important;
  border-radius: 18px !important;
  box-shadow: var(--pt-shadow-card) !important;
  overflow: hidden !important;
  margin-bottom: 24px !important;
  transition: box-shadow 0.25s ease !important;
}

.card.system-overview .card-header {
  padding: 16px 22px !important;
  background: var(--pt-surface-white) !important;
  border-bottom: 1px solid var(--pt-border-clean) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  gap: 14px !important;
}

.card.system-overview .header-left {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

.card.system-overview .header-icon-badge {
  width: 42px !important;
  height: 42px !important;
  border-radius: 12px !important;
  background: rgba(37, 99, 235, 0.08) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: var(--pt-primary) !important;
  border: 1px solid rgba(37, 99, 235, 0.15) !important;
  flex-shrink: 0 !important;
}

.card.system-overview .card-title {
  font-family: var(--pt-font-display) !important;
  font-size: 1.15rem !important;
  font-weight: 700 !important;
  color: var(--pt-text-dark) !important;
  margin: 0 !important;
  letter-spacing: -0.01em !important;
}

.card.system-overview .card-subtitle {
  font-size: 0.8rem !important;
  color: var(--pt-text-muted) !important;
  font-weight: 400 !important;
  margin-top: 1px !important;
}

/* Machine Summary Pills in Card Header */
.card.system-overview .header-summary-group {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
}

.pt-summary-pill {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 5px 12px !important;
  border-radius: 20px !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  font-family: var(--pt-font-body) !important;
  border: 1px solid transparent !important;
  letter-spacing: 0.01em !important;
  transition: all 0.2s ease !important;
}

.pt-summary-pill.total {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border-color: #e2e8f0 !important;
}

.pt-summary-pill.running {
  background: var(--pt-success-light) !important;
  color: var(--pt-success-text) !important;
  border-color: var(--pt-success-border) !important;
}

.pt-summary-pill.idle {
  background: var(--pt-danger-light) !important;
  color: var(--pt-danger-text) !important;
  border-color: var(--pt-danger-border) !important;
}

.pt-summary-pill.other {
  background: var(--pt-warning-light) !important;
  color: var(--pt-warning-text) !important;
  border-color: var(--pt-warning-border) !important;
}

.pt-summary-dot {
  width: 8px !important;
  height: 8px !important;
  border-radius: 50% !important;
  display: inline-block !important;
  flex-shrink: 0 !important;
}

.pt-summary-pill.running .pt-summary-dot {
  background-color: var(--pt-success) !important;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.7) !important;
  animation: ptPulseDot 2s infinite ease-in-out !important;
}

.pt-summary-pill.idle .pt-summary-dot {
  background-color: var(--pt-danger) !important;
}

.pt-summary-pill.other .pt-summary-dot {
  background-color: var(--pt-warning) !important;
}

@keyframes ptPulseDot {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.45;
    transform: scale(0.85);
  }
}

/* Card Content Area - High-Contrast Cool Slate Bay */
.card.system-overview .card-content {
  padding: 16px 18px !important;
  background: #f1f5f9 !important;
  /* Soft cool slate backdrop creating strong contrast against white cards */
  border-top: 1px solid var(--pt-border-clean) !important;
}

/* Compact Responsive Machine Grid (Dense, Clean & Highly Ergonomic) */
.card.system-overview .metrics-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)) !important;
  gap: 12px !important;
  margin-bottom: 0 !important;
  width: 100% !important;
}

/* Individual Compact Machine Card */
.pt-machine-card,
.card.system-overview .metric-card {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  /* Crisp slate border that pops vividly on #f1f5f9 */
  border-radius: 12px !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04) !important;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease !important;
  position: relative !important;
  max-width: 100% !important;
  margin-bottom: 0 !important;
  font-size: 0.85rem !important;
}

.pt-machine-card:hover,
.card.system-overview .metric-card:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 10px 20px -4px rgba(15, 23, 42, 0.12), 0 3px 6px -2px rgba(15, 23, 42, 0.06) !important;
  border-color: #94a3b8 !important;
}

/* Status Accent Indicator Lines */
.pt-machine-card.status-running,
.card.system-overview .metric-card.status-running {
  border-top: 3px solid #10b981 !important;
}

.pt-machine-card.status-idle,
.card.system-overview .metric-card.status-idle {
  border-top: 3px solid #ef4444 !important;
}

.pt-machine-card.status-paused,
.card.system-overview .metric-card.status-paused {
  border-top: 3px solid #f59e0b !important;
}

/* Machine Card Header - Distinctive Semantic Tint */
.pt-mc-header {
  padding: 7px 11px 6px !important;
  border-bottom: 1px solid #e2e8f0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 6px !important;
  transition: background 0.2s ease !important;
}

.pt-machine-card.status-running .pt-mc-header {
  background: #f0fdf4 !important;
  border-bottom-color: #dcfce7 !important;
}

.pt-machine-card.status-idle .pt-mc-header {
  background: #fff1f2 !important;
  border-bottom-color: #ffe4e6 !important;
}

.pt-machine-card.status-paused .pt-mc-header {
  background: #fffbeb !important;
  border-bottom-color: #fef3c7 !important;
}

.pt-mc-station-info {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.pt-mc-dept-tag {
  font-size: 0.68rem !important;
  font-weight: 700 !important;
  padding: 1px 6px !important;
  border-radius: 5px !important;
  font-family: var(--pt-font-display) !important;
  letter-spacing: 0.01em !important;
}

.dept-cut {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border: 1px solid #bfdbfe !important;
}

.dept-ef {
  background: #f0fdfa !important;
  color: #0f766e !important;
  border: 1px solid #99f6e4 !important;
}

.dept-drill {
  background: #faf5ff !important;
  color: #6b21a8 !important;
  border: 1px solid #e9d5ff !important;
}

.dept-asb {
  background: #fff7ed !important;
  color: #c2410c !important;
  border: 1px solid #fed7aa !important;
}

.dept-pk {
  background: #ecfdf5 !important;
  color: #065f46 !important;
  border: 1px solid #a7f3d0 !important;
}

.pt-mc-stn-name {
  font-family: var(--pt-font-display) !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  color: var(--pt-text-dark) !important;
  letter-spacing: 0.01em !important;
  margin: 0 !important;
}

.pt-status-pill {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 2px 7px !important;
  border-radius: 10px !important;
  font-size: 0.7rem !important;
  font-weight: 600 !important;
  font-family: var(--pt-font-body) !important;
  white-space: nowrap !important;
}

.pt-status-pill.running {
  background: #dcfce7 !important;
  color: #166534 !important;
  border: 1px solid #86efac !important;
}

.pt-status-pill.idle {
  background: #fee2e2 !important;
  color: #991b1b !important;
  border: 1px solid #fca5a5 !important;
}

.pt-status-pill.paused {
  background: #fef3c7 !important;
  color: #92400e !important;
  border: 1px solid #fde68a !important;
}

/* Active Work Order Strip */
.pt-mc-job-bar {
  padding: 5px 11px !important;
  background: #f8fafc !important;
  border-bottom: 1px dashed #e2e8f0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  font-size: 0.74rem !important;
}

.pt-job-lbl {
  color: var(--pt-text-muted) !important;
  font-weight: 500 !important;
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
}

.pt-job-code {
  font-family: var(--pt-font-mono) !important;
  font-weight: 700 !important;
  font-size: 0.8rem !important;
  color: var(--pt-primary) !important;
  background: #eff6ff !important;
  padding: 1px 6px !important;
  border-radius: 5px !important;
  border: 1px solid #bfdbfe !important;
  letter-spacing: 0.01em !important;
}

.pt-job-none {
  color: var(--pt-text-light) !important;
  font-style: italic !important;
  font-size: 0.72rem !important;
}

/* Compact Gauge Arc Section */
.pt-mc-gauge-section {
  padding: 10px 10px 8px !important;
  background: #ffffff !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  position: relative !important;
}

.pt-gauge-container {
  position: relative !important;
  width: 140px !important;
  height: 80px !important;
  display: flex !important;
  justify-content: center !important;
  overflow: visible !important;
}

.pt-gauge-svg {
  width: 100% !important;
  height: 100% !important;
  overflow: visible !important;
}

.pt-gauge-track {
  stroke: #e2e8f0 !important;
  stroke-width: 11 !important;
  stroke-linecap: round !important;
  fill: none !important;
}

.pt-gauge-fill {
  stroke-width: 11 !important;
  stroke-linecap: round !important;
  fill: none !important;
  transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.pt-gauge-readout {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  text-align: center !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  pointer-events: none !important;
}

.pt-gauge-value {
  font-family: var(--pt-font-display) !important;
  font-size: 1.35rem !important;
  font-weight: 700 !important;
  color: var(--pt-text-dark) !important;
  line-height: 1 !important;
  letter-spacing: -0.01em !important;
}

.pt-gauge-unit {
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  color: var(--pt-text-muted) !important;
  margin-left: 1px !important;
}

.pt-gauge-label {
  font-size: 0.66rem !important;
  color: var(--pt-text-muted) !important;
  font-weight: 500 !important;
  margin-top: 1px !important;
}

/* Compact Production Pieces Micro Grid */
.pt-mc-quantities {
  width: 100% !important;
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 4px !important;
  margin-top: 7px !important;
  padding-top: 6px !important;
  border-top: 1px solid #f1f5f9 !important;
  text-align: center !important;
}

.pt-qty-box {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 6px !important;
  padding: 3px 2px !important;
  transition: border-color 0.2s ease, background-color 0.2s ease !important;
}

.pt-qty-box:hover {
  border-color: #cbd5e1 !important;
  background: #ffffff !important;
}

.pt-qty-lbl {
  font-size: 0.63rem !important;
  color: var(--pt-text-muted) !important;
  font-weight: 500 !important;
}

.pt-qty-val {
  font-family: var(--pt-font-mono) !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  color: var(--pt-text-dark) !important;
}

.pt-qty-val.produced {
  color: var(--pt-primary) !important;
}

.pt-qty-val.defect {
  color: var(--pt-danger) !important;
}

.pt-qty-defect-alert {
  width: 100% !important;
  margin-top: 5px !important;
  padding: 2px 6px !important;
  background: #fef2f2 !important;
  border: 1px solid #fee2e2 !important;
  border-radius: 5px !important;
  color: #b91c1c !important;
  font-size: 0.68rem !important;
  font-weight: 600 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
}

/* Compact Operational Timeline Stats */
.pt-mc-stats {
  padding: 7px 11px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 4.5px !important;
  background: #ffffff !important;
  border-top: 1px solid #f1f5f9 !important;
  flex-grow: 1 !important;
}

.pt-stat-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  font-size: 0.72rem !important;
}

.pt-stat-label {
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  color: var(--pt-text-muted) !important;
  font-weight: 500 !important;
}

.pt-stat-label i,
.pt-stat-label svg {
  font-size: 0.72rem !important;
  width: 12px !important;
  color: var(--pt-text-light) !important;
}

.pt-stat-val {
  font-weight: 600 !important;
  font-family: var(--pt-font-body) !important;
  color: var(--pt-text-body) !important;
  font-size: 0.74rem !important;
}

.pt-stat-val.run {
  color: #059669 !important;
}

.pt-stat-val.stop {
  color: #d97706 !important;
}

.pt-stat-val.note {
  font-weight: 600 !important;
  max-width: 110px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Compact Card Footer */
.pt-mc-footer {
  padding: 6px 11px !important;
  background: #f8fafc !important;
  border-top: 1px solid #e2e8f0 !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  font-size: 0.68rem !important;
  color: var(--pt-text-muted) !important;
}

.pt-mc-user {
  display: flex !important;
  align-items: center !important;
  gap: 5px !important;
  font-weight: 500 !important;
}

.pt-mc-user i {
  color: var(--pt-primary) !important;
}

.pt-mc-user span {
  color: var(--pt-text-dark) !important;
  font-weight: 600 !important;
}

.pt-mc-ready-tag {
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  font-size: 0.66rem !important;
  font-weight: 600 !important;
}

.pt-mc-ready-tag.running {
  color: #059669 !important;
}

.pt-mc-ready-tag.idle {
  color: #dc2626 !important;
}

.pt-mc-ready-tag.other {
  color: #d97706 !important;
}

/* Responsive adjustments for Machine Grid */
@media (max-width: 768px) {
  .card.system-overview .card-content {
    padding: 10px !important;
  }

  .card.system-overview .metrics-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .card.system-overview .card-header {
    flex-direction: column !important;
    align-items: flex-start !important;
  }

  .card.system-overview .header-summary-group {
    width: 100% !important;
    justify-content: flex-start !important;
  }
}

/* ==========================================================================
   Modern Production Work Orders Card (communications-card & timeline-table)
   Adhering to frontend-design & ui-ux-pro-max guidelines
   ========================================================================== */

/* Main Communications Card Container */
.card.communications-card {
  background: var(--pt-surface-white) !important;
  border: 1px solid rgba(226, 232, 240, 0.95) !important;
  border-radius: 18px !important;
  box-shadow: var(--pt-shadow-card) !important;
  overflow: hidden !important;
  margin-bottom: 24px !important;
}

.card.communications-card .card-header {
  padding: 16px 22px !important;
  background: var(--pt-surface-white) !important;
  border-bottom: 1px solid var(--pt-border-clean) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  gap: 14px !important;
}

.card.communications-card .header-left {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

.card.communications-card .header-icon-badge {
  width: 42px !important;
  height: 42px !important;
  border-radius: 12px !important;
  background: rgba(37, 99, 235, 0.08) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: var(--pt-primary) !important;
  border: 1px solid rgba(37, 99, 235, 0.15) !important;
  flex-shrink: 0 !important;
}

.card.communications-card .card-title {
  font-family: var(--pt-font-display) !important;
  font-size: 1.15rem !important;
  font-weight: 700 !important;
  color: var(--pt-text-dark) !important;
  margin: 0 !important;
}

.card.communications-card .card-subtitle {
  font-size: 0.8rem !important;
  color: var(--pt-text-muted) !important;
  font-weight: 400 !important;
  margin-top: 1px !important;
}

.card.communications-card .card-content {
  padding: 20px !important;
  background: #ffffff !important;
}

/* Toolbar: Search Container & Status Legend Bar */
.timeline-header-toolbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px !important;
  flex-wrap: wrap !important;
  margin-bottom: 16px !important;
}

.search-container {
  position: relative !important;
  width: 380px !important;
  max-width: 100% !important;
  margin: 0 !important;
}

/* Dedicated wrapper isolating input and icons from countdown hints */
.search-input-wrapper {
  position: relative !important;
  width: 100% !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

/* Search input with fixed box-sizing and height for exact icon centering across all viewports */
#searchInput {
  display: block !important;
  width: 100% !important;
  height: 42px !important;
  line-height: normal !important;
  box-sizing: border-box !important;
  padding: 0 40px 0 38px !important;
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 10px !important;
  font-size: 0.88rem !important;
  color: var(--pt-text-dark) !important;
  font-family: var(--pt-font-body) !important;
  transition: all 0.2s ease !important;
  outline: none !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

#searchInput:focus {
  border-color: var(--pt-primary) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
  background: #ffffff !important;
}

#searchInput:hover {
  border-color: #94a3b8 !important;
}

/* Search Icon: perfectly centered vertically inside the input box */
.search-input-wrapper .search-icon,
.search-container .search-icon {
  position: absolute !important;
  top: 50% !important;
  left: 14px !important;
  transform: translateY(-50%) !important;
  color: #64748b !important;
  font-size: 14px !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 16px !important;
  height: 16px !important;
  pointer-events: none !important;
  z-index: 5 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Direct container child fallback: pin to 21px (50% of 42px input) so hint expansion never shifts it */
.search-container>.search-icon {
  top: 21px !important;
  transform: translateY(-50%) !important;
}

.search-input-wrapper>.search-icon {
  top: 50% !important;
  transform: translateY(-50%) !important;
}

/* Search Loading Spinner */
.search-container.searching .search-icon,
.search-input-wrapper .search-icon.fa-spin {
  color: #2563eb !important;
  animation: ptSpinCentered 0.8s infinite linear !important;
}

@keyframes ptSpinCentered {
  0% {
    transform: translateY(-50%) rotate(0deg);
  }

  100% {
    transform: translateY(-50%) rotate(360deg);
  }
}

/* Clear Search Button */
.search-input-wrapper .clear-search-btn,
.search-container .clear-search-btn {
  position: absolute !important;
  right: 12px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  background: none !important;
  border: none !important;
  color: #94a3b8 !important;
  cursor: pointer !important;
  font-size: 18px !important;
  line-height: 1 !important;
  padding: 0 !important;
  display: none;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
  width: 24px !important;
  height: 24px !important;
  z-index: 5 !important;
  margin: 0 !important;
  transition: color 0.15s ease, background 0.15s ease !important;
}

.search-container>.clear-search-btn {
  top: 21px !important;
  transform: translateY(-50%) !important;
}

.search-input-wrapper>.clear-search-btn {
  top: 50% !important;
  transform: translateY(-50%) !important;
}

.clear-search-btn:hover {
  color: #ef4444 !important;
  background: #fee2e2 !important;
}

/* Search delay countdown hint */
.search-delay-hint {
  position: absolute !important;
  top: calc(100% + 6px) !important;
  left: 0 !important;
  right: 0 !important;
  background: #ffffff !important;
  border: 1px solid #bfdbfe !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12) !important;
  border-radius: 8px !important;
  padding: 6px 12px 8px 12px !important;
  font-size: 0.76rem !important;
  color: #1e40af !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  z-index: 50 !important;
  overflow: hidden !important;
  animation: ptFadeInDown 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.search-delay-hint .search-countdown-bar {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  height: 3px !important;
  background: linear-gradient(90deg, #2563eb, #38bdf8) !important;
  width: 100% !important;
}

.search-delay-hint kbd {
  background: #eff6ff !important;
  border: 1px solid #bfdbfe !important;
  border-radius: 4px !important;
  padding: 1px 5px !important;
  font-family: inherit !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  color: #1d4ed8 !important;
}

.search-delay-text {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
}

.search-delay-text strong {
  color: #2563eb !important;
  font-family: var(--pt-font-mono) !important;
  font-size: 0.82rem !important;
}

.search-delay-text .search-hint-sub {
  color: #64748b !important;
  font-size: 0.72rem !important;
}

/* In-place Table Updating Transition State */
.timeline-table-wrapper.table-updating {
  opacity: 0.55 !important;
  pointer-events: none !important;
  transition: opacity 0.2s ease !important;
}

/* Timeline Legend Strip */
.timeline-legend {
  display: inline-flex !important;
  align-items: center !important;
  gap: 12px !important;
  flex-wrap: wrap !important;
  padding: 7px 14px !important;
  background: #f8fafc !important;
  border-radius: 10px !important;
  border: 1px solid #e2e8f0 !important;
}

.timeline-legend .legend-item {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  font-size: 0.74rem !important;
  color: var(--pt-text-muted) !important;
  font-weight: 500 !important;
}

/* Step Indicators (Department Pipeline) */
.step-container {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  height: 2.2rem !important;
}

.step {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 1.85rem !important;
  height: 1.85rem !important;
  border-radius: 50% !important;
  position: relative !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
}

.step i {
  font-size: 0.78rem !important;
  z-index: 2 !important;
}

.step.completed {
  background: #ecfdf5 !important;
  color: #059669 !important;
  border: 1.5px solid #a7f3d0 !important;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.2) !important;
}

.step.in-progress,
.step.in-progress-2 {
  background: #eff6ff !important;
  color: #2563eb !important;
  border: 1.5px solid #93c5fd !important;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.25) !important;
}

.step.wait,
.step.wait-2 {
  background: #fffbeb !important;
  color: #d97706 !important;
  border: 1.5px solid #fde68a !important;
}

.step.not-started {
  background: #f1f5f9 !important;
  color: #94a3b8 !important;
  border: 1.5px solid #e2e8f0 !important;
}

.step.not-started2 {
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border: 1.5px solid #fecaca !important;
}

/* Timeline Table Wrapper & Futuristic Table */
.timeline-table-wrapper {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04) !important;
  width: 100% !important;
}

.futuristic-table {
  width: 100% !important;
  border-collapse: collapse !important;
  font-size: 0.82rem !important;
  text-align: center !important;
}

.futuristic-table thead {
  position: sticky !important;
  top: 0 !important;
  z-index: 10 !important;
}

.futuristic-table th {
  background: #f8fafc !important;
  color: #334155 !important;
  font-family: var(--pt-font-display) !important;
  font-weight: 700 !important;
  font-size: 0.78rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.02em !important;
  padding: 12px 10px !important;
  border-bottom: 2px solid #cbd5e1 !important;
  white-space: nowrap !important;
}

.futuristic-table th::after {
  display: none !important;
}

.futuristic-table tbody tr {
  background-color: #ffffff !important;
  border-bottom: 1px solid #f1f5f9 !important;
  transition: background-color 0.15s ease !important;
}

.futuristic-table tbody tr:hover td {
  background-color: #f8fafc !important;
}

.futuristic-table td {
  padding: 10px 10px !important;
  border-bottom: 1px solid #f1f5f9 !important;
  color: #1e293b !important;
  vertical-align: middle !important;
}

/* Row Highlights with High-Contrast Semantic Borders */
.overdue-row td {
  background-color: #fff5f5 !important;
}

.overdue-row:hover td {
  background-color: #fee2e2 !important;
}

.overdue-row td:first-child {
  border-left: 4px solid #ef4444 !important;
}

.due-today-row td {
  background-color: #f0f9ff !important;
}

.due-today-row:hover td {
  background-color: #e0f2fe !important;
}

.due-today-row td:first-child {
  border-left: 4px solid #0284c7 !important;
}

.warning-row td {
  background-color: #fffdf5 !important;
}

.warning-row:hover td {
  background-color: #fef3c7 !important;
}

.warning-row td:first-child {
  border-left: 4px solid #f59e0b !important;
}

/* Row Number & Cell Badges */
.row-number {
  width: 50px !important;
}

.number-badge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 26px !important;
  height: 26px !important;
  background: #f1f5f9 !important;
  border-radius: 50% !important;
  font-family: var(--pt-font-mono) !important;
  font-weight: 700 !important;
  font-size: 0.76rem !important;
  color: #475569 !important;
  border: 1px solid #e2e8f0 !important;
}

.date-display {
  font-family: var(--pt-font-mono) !important;
  font-weight: 600 !important;
  color: var(--pt-text-dark) !important;
  font-size: 0.8rem !important;
  margin-bottom: 2px !important;
}

.status-tag {
  display: inline-block !important;
  font-size: 0.68rem !important;
  padding: 2px 7px !important;
  border-radius: 6px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  box-shadow: none !important;
}

.status-tag.overdue {
  background: #fef2f2 !important;
  color: #991b1b !important;
  border: 1px solid #fecaca !important;
  animation: none !important;
}

.status-tag.due-today {
  background: #eff6ff !important;
  color: #1e40af !important;
  border: 1px solid #bfdbfe !important;
  animation: none !important;
}

.status-tag.warning {
  background: #fffbeb !important;
  color: #92400e !important;
  border: 1px solid #fde68a !important;
  animation: none !important;
}

.job-cell {
  text-align: left !important;
  min-width: 140px !important;
}

.job-cell .job-number {
  font-family: var(--pt-font-mono) !important;
  font-weight: 700 !important;
  color: var(--pt-primary) !important;
  font-size: 0.84rem !important;
  margin-bottom: 1px !important;
}

.job-cell .job-name {
  font-size: 0.74rem !important;
  color: var(--pt-text-muted) !important;
  font-weight: 500 !important;
}

/* Date Filter Column in Table Header */
.date-filter-wrap {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 3px !important;
}

.date-input-container {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  width: 125px !important;
}

.date-filter-input {
  width: 100% !important;
  padding: 3px 20px 3px 6px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 6px !important;
  background: #ffffff !important;
  color: #0f172a !important;
  font-size: 0.72rem !important;
  text-align: center !important;
  outline: none !important;
  font-family: var(--pt-font-mono) !important;
  transition: all 0.2s ease !important;
}

.date-filter-input:focus {
  border-color: var(--pt-primary) !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15) !important;
}

.date-input-container .date-icon {
  position: absolute !important;
  right: 6px !important;
  color: var(--pt-primary) !important;
  font-size: 10px !important;
  pointer-events: none !important;
}

.date-clear-btn {
  font-size: 0.65rem !important;
  color: #ef4444 !important;
  text-decoration: none !important;
  font-weight: 600 !important;
  display: inline-block !important;
  padding: 1px 6px !important;
  background: #fef2f2 !important;
  border-radius: 10px !important;
  border: 1px solid #fecaca !important;
}

.date-clear-btn:hover {
  background: #fee2e2 !important;
  color: #b91c1c !important;
}

/* Pagination Bar */
.pagination {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 12px !important;
  margin-top: 16px !important;
  padding: 12px 16px !important;
  background: #f8fafc !important;
  border-radius: 10px !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.pagination-info {
  font-size: 0.8rem !important;
  color: #475569 !important;
  font-weight: 500 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
}

.search-info {
  color: #1d4ed8 !important;
  font-weight: 600 !important;
  background: #eff6ff !important;
  padding: 2px 10px !important;
  border-radius: 14px !important;
  border: 1px solid #bfdbfe !important;
  font-family: var(--pt-font-mono) !important;
  font-size: 0.76rem !important;
}

.pagination-buttons {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  flex-wrap: wrap !important;
}

.pagination-button {
  padding: 4px 10px !important;
  background: #ffffff !important;
  color: #334155 !important;
  text-decoration: none !important;
  border-radius: 6px !important;
  border: 1px solid #cbd5e1 !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  font-family: var(--pt-font-mono) !important;
  min-width: 32px !important;
  text-align: center !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
  transform: none !important;
  text-shadow: none !important;
}

.pagination-button:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08) !important;
}

.pagination-button.active {
  background: var(--pt-primary) !important;
  color: #ffffff !important;
  border-color: var(--pt-primary) !important;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35) !important;
  transform: none !important;
}

.pagination-ellipsis {
  color: #94a3b8 !important;
  padding: 0 4px !important;
  font-size: 0.85rem !important;
}

/* Responsive adjustments for Communications Card */
@media (max-width: 1024px) {
  .timeline-header-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  .search-container {
    width: 100% !important;
    position: relative !important;
  }

  .search-input-wrapper {
    width: 100% !important;
    position: relative !important;
  }

  /* Keep search-icon strictly centered in input on tablet/mobile */
  .search-input-wrapper .search-icon,
  .search-container .search-icon {
    left: 14px !important;
    font-size: 14px !important;
    line-height: 1 !important;
  }

  .search-container>.search-icon {
    top: 21px !important;
    transform: translateY(-50%) !important;
  }

  .search-input-wrapper>.search-icon {
    top: 50% !important;
    transform: translateY(-50%) !important;
  }

  .search-container>.clear-search-btn {
    top: 21px !important;
    transform: translateY(-50%) !important;
  }

  .search-input-wrapper>.clear-search-btn {
    top: 50% !important;
    transform: translateY(-50%) !important;
  }

  /* Prevent search-delay-hint from overlapping timeline-legend on mobile/tablets */
  .search-delay-hint {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    margin-top: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    animation: ptFadeInDownMobile 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  .timeline-legend {
    width: 100% !important;
    justify-content: flex-start !important;
    gap: 8px 12px !important;
    box-sizing: border-box !important;
  }
}

@keyframes ptFadeInDownMobile {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  #searchInput {
    height: 40px !important;
    font-size: 0.84rem !important;
    padding: 0 36px 0 36px !important;
  }

  .search-container>.search-icon {
    top: 20px !important;
    left: 12px !important;
  }

  .search-input-wrapper>.search-icon {
    top: 50% !important;
    left: 12px !important;
  }

  .search-container>.clear-search-btn {
    top: 20px !important;
    right: 10px !important;
  }

  .search-input-wrapper>.clear-search-btn {
    top: 50% !important;
    right: 10px !important;
  }

  .search-delay-hint {
    padding: 6px 10px 8px 10px !important;
    font-size: 0.72rem !important;
  }

  .search-delay-text {
    flex-wrap: wrap !important;
    gap: 4px !important;
  }

  .timeline-legend {
    gap: 6px 10px !important;
    padding: 6px 10px !important;
  }

  .timeline-legend .legend-item {
    font-size: 0.70rem !important;
    gap: 4px !important;
  }

  .timeline-legend .legend-item .step {
    width: 1.45rem !important;
    height: 1.45rem !important;
  }
}

@media (max-width: 768px) {
  .card.communications-card .card-header {
    flex-direction: column !important;
    align-items: flex-start !important;
  }

  .card.communications-card .header-summary-group {
    width: 100% !important;
    justify-content: flex-start !important;
  }

  .pagination {
    flex-direction: column !important;
    align-items: center !important;
    gap: 10px !important;
  }

  .pagination-info {
    justify-content: center !important;
    text-align: center !important;
  }
}

/* ==========================================================================
   Harmonized Precision Typography & Slashed Zero (0 vs O Visual Distinction)
   - "0" (Number Zero) displays with a distinct diagonal slash (0̸) or central dot.
   - "O" (Capital Letter O) displays as a clean open rounded letter.
   - All tabular figures, codes, dates, and numbers align in crisp vertical columns.
   - Thai characters seamlessly fall back to IBM Plex Sans Thai with unified styling.
   ========================================================================== */

/* Universal Data & Table Typography Unification */
.futuristic-table,
.futuristic-table th,
.futuristic-table td,
.row-number,
.number-badge,
.date-display,
.customer-cell,
.customer-cell strong,
.job-cell,
.job-cell .job-number,
.job-cell .job-name,
.finish-time-cell,
.status-tag,
#searchInput,
#dateFilter,
.date-filter-input,
.search-delay-hint,
.search-delay-text,
.search-info,
.pagination,
.pagination-info,
.pagination-button,
.header-summary-group .pt-summary-pill,
.header-summary-group .pt-summary-pill strong,
.timeline-legend,
.timeline-legend .legend-item,
.pt-job-code,
.pt-gauge-value,
.pt-qty-val,
.stat-value,
.stat-item,
.pill-number,
#systemTime,
.date-input-container {
  font-family: var(--pt-font-data) !important;
  font-variant-numeric: slashed-zero tabular-nums !important;
  font-feature-settings: "zero" 1, "tnum" 1 !important;
}

/* Micro-adjustments for Serial Numbers, Codes, and Job IDs (0 vs O Clarity) */
.job-cell .job-number,
.pt-job-code,
.date-display,
.finish-time-cell,
#searchInput,
.date-filter-input,
.search-info {
  letter-spacing: 0.03em !important;
}

/* High-Contrast Distinguishable Typography in Table Cells */
.job-cell .job-number {
  font-weight: 700 !important;
  color: var(--pt-primary) !important;
  font-size: 0.86rem !important;
}

.customer-cell strong {
  font-weight: 600 !important;
  color: #0f172a !important;
}

.date-display {
  font-weight: 600 !important;
  color: #1e293b !important;
  font-size: 0.82rem !important;
}

.finish-time-cell {
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  color: #334155 !important;
}

/* Search Input Character Precision */
#searchInput {
  font-size: 0.88rem !important;
  font-weight: 500 !important;
  color: #0f172a !important;
}

#searchInput::placeholder {
  font-family: var(--pt-font-body) !important;
  letter-spacing: normal !important;
  font-size: 0.84rem !important;
  color: #94a3b8 !important;
}

/* Flatpickr Calendar Numerals Distinction */
.flatpickr-day,
.flatpickr-current-month input.cur-year,
.flatpickr-time input {
  font-family: var(--pt-font-data) !important;
  font-variant-numeric: slashed-zero tabular-nums !important;
  font-feature-settings: "zero" 1, "tnum" 1 !important;
}

/* ==========================================================================
   PT CLOUD: Modern Operations Hub - Order Import & Management (importexcel.php)
   Conforming to frontend-design_SKILL.md & ui-ux-pro-max_SKILL.md
   - Industrial Cyber-Precision Style
   - Font Pairing: Prompt (Display/Headers) + IBM Plex Sans Thai (Body) + JetBrains Mono (Data/Codes/Numbers)
   - Zero-vs-O Slashed Zero (0̸) differentiation
   - Touch Target >= 44x44px for touchscreens/mobile
   - Fully Responsive: Mobile (320px-640px), Tablet (641px-1024px), Desktop (>1024px)
   ========================================================================== */

/* 1. Main Card Container */
.card.system-overview {
  background: var(--pt-surface-white, #ffffff) !important;
  border-radius: 14px !important;
  border: 1px solid var(--pt-border-clean, #e2e8f0) !important;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06) !important;
  overflow: hidden !important;
  margin-bottom: 24px !important;
  transition: box-shadow 0.25s ease !important;
}

.card.system-overview:hover {
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.09) !important;
}

/* 2. Card Header: Industrial Precision Bar */
.card.system-overview .card-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 16px 22px !important;
  background: #ffffff !important;
  border-bottom: 1.5px solid #e2e8f0 !important;
  gap: 16px !important;
  flex-wrap: wrap !important;
}

.card.system-overview .header-left {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  flex-wrap: wrap !important;
}

.card.system-overview .header-icon-badge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 10px !important;
  background: #eff6ff !important;
  color: #2563eb !important;
  border: 1.5px solid #bfdbfe !important;
  font-size: 18px !important;
  flex-shrink: 0 !important;
}

.card.system-overview .card-title {
  margin: 0 !important;
  font-family: var(--pt-font-display, 'Prompt', sans-serif) !important;
  font-size: 1.22rem !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  letter-spacing: -0.01em !important;
}

.card.system-overview .order-count-badge {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  background: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 20px !important;
  padding: 4px 14px !important;
  font-size: 0.78rem !important;
  font-family: var(--pt-font-data, 'JetBrains Mono', monospace) !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em !important;
}

.card.system-overview .order-count-badge strong {
  color: #2563eb !important;
  font-weight: 700 !important;
}

/* Header Action Button: Create Order Button */
.btn-create-order,
.neo-button-plus {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  padding: 9px 20px !important;
  min-height: 42px !important;
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 10px !important;
  font-family: var(--pt-font-display, 'Prompt', sans-serif) !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28) !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  text-decoration: none !important;
}

.btn-create-order:hover,
.neo-button-plus:hover {
  transform: translateY(-1.5px) !important;
  box-shadow: 0 5px 16px rgba(37, 99, 235, 0.42) !important;
  background: linear-gradient(135deg, #1d4ed8, #1e40af) !important;
  color: #ffffff !important;
}

.btn-create-order:active,
.neo-button-plus:active {
  transform: translateY(0) !important;
}

/* 3. Search & Filter Bar: Responsive Grid */
.search-filters {
  margin: 0 0 20px 0 !important;
  background: #f8fafc !important;
  border-radius: 12px !important;
  padding: 16px !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03) !important;
}

.search-filters .filter-group {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) auto !important;
  gap: 14px !important;
  align-items: flex-end !important;
}

.filter-item {
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  margin: 0 !important;
  min-width: 0 !important;
}

.filter-item label {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  font-family: var(--pt-font-display, 'Prompt', sans-serif) !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  color: #334155 !important;
  margin: 0 !important;
  white-space: nowrap !important;
}

.filter-item label i {
  color: #2563eb !important;
  font-size: 0.8rem !important;
}

.search-input-container {
  position: relative !important;
  width: 100% !important;
}

.filter-input {
  width: 100% !important;
  height: 40px !important;
  padding: 0 34px 0 12px !important;
  border-radius: 8px !important;
  border: 1.5px solid #cbd5e1 !important;
  background-color: #ffffff !important;
  color: #0f172a !important;
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif) !important;
  font-size: 0.86rem !important;
  box-sizing: border-box !important;
  transition: all 0.2s ease !important;
  outline: none !important;
  -webkit-appearance: none !important;
}

/* Order search input uses JetBrains Mono with Slashed Zero */
#jobOrderSearch {
  font-family: var(--pt-font-data, 'JetBrains Mono', monospace) !important;
  font-variant-numeric: slashed-zero tabular-nums !important;
  font-feature-settings: "zero" 1, "tnum" 1 !important;
  letter-spacing: 0.02em !important;
}

.filter-input:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
  background-color: #ffffff !important;
}

.clear-search {
  position: absolute !important;
  right: 6px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  background: none !important;
  border: none !important;
  font-size: 16px !important;
  line-height: 1 !important;
  color: #94a3b8 !important;
  cursor: pointer !important;
  width: 24px !important;
  height: 24px !important;
  border-radius: 50% !important;
  display: none;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.15s ease !important;
  z-index: 5 !important;
}

.clear-search:hover {
  background-color: #fee2e2 !important;
  color: #ef4444 !important;
}

.clear-all-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  height: 40px !important;
  padding: 0 16px !important;
  background: #ffffff !important;
  color: #ef4444 !important;
  border: 1.5px solid #fecaca !important;
  border-radius: 8px !important;
  font-family: var(--pt-font-display, 'Prompt', sans-serif) !important;
  font-size: 0.84rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 1px 2px rgba(239, 68, 68, 0.08) !important;
  margin: 0 !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
}

.clear-all-btn:hover {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #dc2626 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 3px 8px rgba(239, 68, 68, 0.15) !important;
}

/* 4. Main Futuristic Table */
.table-container {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  border-radius: 12px !important;
  border: 1px solid #e2e8f0 !important;
  background: #ffffff !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
  margin-bottom: 16px !important;
}

.futuristic-table {
  width: 100% !important;
  border-collapse: collapse !important;
  border-spacing: 0 !important;
  font-size: 0.84rem !important;
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif) !important;
}

.futuristic-table thead {
  position: sticky !important;
  top: 0 !important;
  z-index: 10 !important;
  background: #f8fafc !important;
}

.futuristic-table th {
  padding: 13px 14px !important;
  background: #f8fafc !important;
  color: #334155 !important;
  font-family: var(--pt-font-display, 'Prompt', sans-serif) !important;
  font-weight: 700 !important;
  font-size: 0.82rem !important;
  text-align: center !important;
  border-bottom: 2px solid #e2e8f0 !important;
  white-space: nowrap !important;
  letter-spacing: 0.01em !important;
}

.futuristic-table tbody tr.main-row {
  border-bottom: 1px solid #f1f5f9 !important;
  transition: background-color 0.15s ease !important;
}

.futuristic-table tbody tr.main-row:hover {
  background-color: #f8fafc !important;
}

.futuristic-table td {
  padding: 11px 14px !important;
  color: #334155 !important;
  vertical-align: middle !important;
  border-bottom: 1px solid #f1f5f9 !important;
}

/* Data Typography (JetBrains Mono with Slashed Zero) */
.order-link,
.order-code-badge,
.futuristic-table td:nth-child(1),
.futuristic-table td:nth-child(2),
.futuristic-table td:nth-child(7),
.nested-table td:nth-child(1),
.nested-table td:nth-child(3),
.nested-table td:nth-child(4) {
  font-family: var(--pt-font-data, 'JetBrains Mono', monospace) !important;
  font-variant-numeric: slashed-zero tabular-nums !important;
  font-feature-settings: "zero" 1, "tnum" 1 !important;
  letter-spacing: 0.02em !important;
}

/* Order Link / Badge */
.order-link {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 5px 11px !important;
  background: #eff6ff !important;
  border: 1px solid #bfdbfe !important;
  border-radius: 6px !important;
  color: #1d4ed8 !important;
  font-weight: 700 !important;
  font-size: 0.84rem !important;
  text-decoration: none !important;
  transition: all 0.18s ease !important;
}

.order-link:hover {
  background: #dbeafe !important;
  border-color: #93c5fd !important;
  color: #1e40af !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.15) !important;
}

.order-link .expand-icon {
  font-size: 11px !important;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  color: #3b82f6 !important;
}

[aria-expanded="true"] .expand-icon {
  transform: rotate(180deg) !important;
}

/* New Job Blinking Indicator (Refined Cyber Pulse Badge) */
.newjob-btn,
.newjob-indicator {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border: 1.5px solid #fecaca !important;
  padding: 3px 9px !important;
  font-size: 0.8rem !important;
  font-family: var(--pt-font-data, 'JetBrains Mono', monospace) !important;
  font-weight: 700 !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  animation: ptCyberPulse 2s infinite ease-in-out !important;
  transition: all 0.2s ease !important;
}

.newjob-btn:hover {
  background: #fee2e2 !important;
  border-color: #f87171 !important;
  transform: scale(1.04) !important;
}

@keyframes ptCyberPulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    border-color: #fecaca;
  }

  50% {
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0);
    border-color: #ef4444;
  }
}

/* 5. Nested Detail Table Container */
.detail-content {
  padding: 0 !important;
  background-color: #f8fafc !important;
  border-bottom: 2px solid #e2e8f0 !important;
}

.detail-container {
  padding: 16px 20px !important;
  background: #f8fafc !important;
  border-left: 4px solid #2563eb !important;
}

.detail-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  margin-bottom: 12px !important;
  padding-bottom: 8px !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

.detail-header h3 {
  margin: 0 !important;
  font-family: var(--pt-font-display, 'Prompt', sans-serif) !important;
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  color: #1e40af !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.nested-table-container {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  border-radius: 8px !important;
  border: 1px solid #e2e8f0 !important;
  background-color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
}

.nested-table {
  width: 100% !important;
  border-collapse: collapse !important;
  font-size: 0.8rem !important;
}

.nested-table thead {
  background: #f1f5f9 !important;
}

.nested-table th {
  padding: 9px 12px !important;
  text-align: center !important;
  font-family: var(--pt-font-display, 'Prompt', sans-serif) !important;
  font-weight: 600 !important;
  font-size: 0.78rem !important;
  color: #475569 !important;
  border-bottom: 1px solid #cbd5e1 !important;
  white-space: nowrap !important;
}

.nested-table tbody tr {
  border-bottom: 1px solid #f1f5f9 !important;
  transition: background-color 0.15s ease !important;
}

.nested-table tbody tr:hover {
  background-color: #f8fafc !important;
}

.nested-table td {
  padding: 8px 12px !important;
  color: #334155 !important;
  vertical-align: middle !important;
}

/* Priority Badges */
.priority-high {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 3px 8px !important;
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border: 1px solid #fecaca !important;
  border-radius: 6px !important;
  font-weight: 600 !important;
  font-size: 0.74rem !important;
  white-space: nowrap !important;
}

.priority-high::before {
  content: "" !important;
  width: 6px !important;
  height: 6px !important;
  border-radius: 50% !important;
  background: #ef4444 !important;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6) !important;
}

.priority-low,
.priority-normal {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 3px 8px !important;
  background: #f0fdf4 !important;
  color: #16a34a !important;
  border: 1px solid #bbf7d0 !important;
  border-radius: 6px !important;
  font-weight: 500 !important;
  font-size: 0.74rem !important;
  white-space: nowrap !important;
}

.priority-low::before,
.priority-normal::before {
  content: "" !important;
  width: 6px !important;
  height: 6px !important;
  border-radius: 50% !important;
  background: #22c55e !important;
}

.priority-cancelled {
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  padding: 3px 8px !important;
  background: #f1f5f9 !important;
  color: #64748b !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 6px !important;
  font-weight: 500 !important;
  font-size: 0.74rem !important;
  text-decoration: line-through !important;
}

/* Job detail link in nested table */
.job-detail-link {
  font-family: var(--pt-font-data, 'JetBrains Mono', monospace) !important;
  font-weight: 600 !important;
  color: #2563eb !important;
  text-decoration: none !important;
  transition: all 0.15s ease !important;
}

.job-detail-link:hover {
  color: #1d4ed8 !important;
  text-decoration: underline !important;
}

/* 6. Action Buttons */
.action-buttons {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.action-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 6px !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  cursor: pointer !important;
  transition: all 0.18s ease !important;
  padding: 0 !important;
  font-size: 14px !important;
  text-decoration: none !important;
}

.action-button svg {
  width: 17px !important;
  height: 17px !important;
}

.action-button.plus-btn {
  color: #059669 !important;
  background: #ecfdf5 !important;
  border-color: #a7f3d0 !important;
}

.action-button.plus-btn:hover {
  background: #d1fae5 !important;
  color: #047857 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.2) !important;
}

.action-button.delete-order,
.action-button.delete-btn {
  color: #dc2626 !important;
  background: #fef2f2 !important;
  border-color: #fecaca !important;
}

.action-button.delete-order:hover,
.action-button.delete-btn:hover {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.2) !important;
}

.action-button.upfile_btn {
  color: #16a34a !important;
  background: #f0fdf4 !important;
  border-color: #bbf7d0 !important;
}

.action-button.upfile_btn:hover {
  background: #dcfce7 !important;
  color: #15803d !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.2) !important;
}

.action-button.print-btn {
  color: #0891b2 !important;
  background: #ecfeff !important;
  border-color: #a5f3fc !important;
}

.action-button.print-btn:hover {
  background: #cffafe !important;
  color: #0e7490 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 6px rgba(8, 145, 178, 0.2) !important;
}

/* 7. Modals: Unified Cyber-Precision Glass */
.modal {
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  background-color: rgba(7, 11, 20, 0.65) !important;
  z-index: 1050 !important;
}

.modal-content {
  background: #ffffff !important;
  border-radius: 14px !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3) !important;
  overflow: hidden !important;
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif) !important;
}

.modal-header {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #ffffff !important;
  padding: 14px 20px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.modal-header h3,
.modal-header h5,
.modal-title {
  font-family: var(--pt-font-display, 'Prompt', sans-serif) !important;
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  margin: 0 !important;
}

.close-modal,
.modal-header .btn-close {
  color: #ffffff !important;
  opacity: 0.85 !important;
  transition: opacity 0.15s ease, transform 0.15s ease !important;
}

.close-modal:hover,
.modal-header .btn-close:hover {
  opacity: 1 !important;
  transform: scale(1.1) !important;
}

.modal-body {
  padding: 20px !important;
  color: #334155 !important;
}

.modal-nav {
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
  padding: 10px 16px !important;
  gap: 8px !important;
}

.modal-nav .btn-secondary {
  background: #ffffff !important;
  color: #475569 !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  font-family: var(--pt-font-display, 'Prompt', sans-serif) !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  padding: 6px 14px !important;
  transition: all 0.18s ease !important;
}

.modal-nav .btn-secondary.active,
.modal-nav .btn-secondary:hover {
  background: #2563eb !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
}

/* 8. Responsive Rules */
@media (max-width: 1024px) {
  .search-filters .filter-group {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .search-filters .filter-item.filter-action {
    grid-column: span 2 !important;
  }

  .clear-all-btn {
    width: 100% !important;
  }

  .futuristic-table th,
  .futuristic-table td {
    padding: 10px 10px !important;
  }
}

@media (max-width: 640px) {
  .search-filters .filter-group {
    grid-template-columns: 1fr !important;
  }

  .search-filters .filter-item.filter-action {
    grid-column: span 1 !important;
  }

  .card.system-overview .card-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  .btn-create-order,
  .neo-button-plus {
    width: 100% !important;
  }

  .action-button {
    width: 38px !important;
    height: 38px !important;
  }

  .modal-content {
    width: 96% !important;
    margin: 10px auto !important;
    max-height: 92vh !important;
  }
}

/* ======================================================
   Scroll-to-Top Button — importexcel.php
   ====================================================== */
.scroll-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.8);
  z-index: 1000;
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.scroll-to-top:hover {
  background: linear-gradient(135deg, #0891b2, #0e7490);
  transform: translateY(-2px) scale(1.1);
  box-shadow: 0 8px 25px rgba(6, 182, 212, 0.6);
}

.scroll-to-top:active {
  transform: translateY(0) scale(0.95);
}

.scroll-to-top svg {
  width: 24px;
  height: 24px;
  color: white;
  transition: transform 0.3s ease;
}

.scroll-to-top:hover svg {
  transform: translateY(-2px);
}

.scroll-to-top.pulse {
  animation: scrollTopPulse 2s infinite;
}

@keyframes scrollTopPulse {
  0% {
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4);
  }

  50% {
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.8), 0 0 0 10px rgba(6, 182, 212, 0.1);
  }

  100% {
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4);
  }
}

/* ======================================================
   .filter-action — spans 2 columns on tablet grid
   ====================================================== */
.filter-action {
  display: flex;
  align-items: flex-end;
}

.filter-action .clear-all-btn {
  width: 100%;
  justify-content: center;
}

@media (max-width: 1024px) {
  .filter-action {
    grid-column: span 2;
  }
}

@media (max-width: 640px) {
  .filter-action {
    grid-column: span 1;
  }
}

/* ======================================================
   .no-data — empty state row in tables
   ====================================================== */
.futuristic-table td.no-data,
.nested-table td.no-data {
  text-align: center;
  padding: 32px 16px;
  color: var(--pt-text-muted, #64748b);
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-style: italic;
  font-size: 0.9rem;
}

/* ======================================================
   Priority badge refinements for nested table
   ====================================================== */
.nested-table td.priority-high,
.nested-table td.priority-low,
.nested-table td.priority-normal,
.nested-table td.priority-cancelled {
  vertical-align: middle;
  white-space: nowrap;
}

/* Cancelled job-detail-link strikethrough */
.nested-table tr .job-detail-link[style*="rgb(231"] {
  text-decoration: line-through;
  opacity: 0.7;
}

/* ======================================================
   Upload modal file buttons (view-btn-in-modal)
   ====================================================== */
.file-buttons-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
}

.view-btn-in-modal {
  min-height: 38px;
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  transition: all 0.2s;
}

/* ======================================================
   Form groups in jobModal / uploadModal
   ====================================================== */
.modal-body .form-group label {
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--pt-text-secondary, #64748b);
  margin-bottom: 4px;
  display: block;
}

.modal-body .form-group input[type="text"],
.modal-body .form-group input[type="file"],
.modal-body .form-group select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 8px;
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.9rem;
  background: rgba(248, 250, 252, 0.8);
  color: var(--pt-text-primary, #1e293b);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.modal-body .form-group input[type="text"]:focus,
.modal-body .form-group select:focus {
  outline: none;
  border-color: var(--pt-accent-primary, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.modal-body .form-group input[type="file"] {
  height: auto;
  padding: 6px 12px;
  cursor: pointer;
}

/* Required star */
.modal-body .form-group font[style*="color: #ff0707"] {
  font-family: inherit;
  font-weight: 700;
}

/* Form actions in modals */
.modal-body .form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(99, 102, 241, 0.1);
}

.modal-body .submit-btn {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  border: none;
  padding: 9px 22px;
  border-radius: 8px;
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
  transition: all 0.2s;
}

.modal-body .submit-btn:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.modal-body .cancel-btn {
  background: rgba(99, 102, 241, 0.08);
  color: var(--pt-text-secondary, #64748b);
  border: 1px solid rgba(99, 102, 241, 0.2);
  padding: 9px 22px;
  border-radius: 8px;
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  min-height: 40px;
  transition: all 0.2s;
}

.modal-body .cancel-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  color: var(--pt-text-primary, #1e293b);
}

/* ======================================================
   Responsive: nested table columns on small screens
   ====================================================== */
@media (max-width: 640px) {
  .nested-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nested-table th,
  .nested-table td {
    padding: 8px 10px;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .scroll-to-top {
    bottom: 20px;
    right: 16px;
    width: 44px;
    height: 44px;
  }
}

/* ================================================================
   MODAL SYSTEM v2 — Appended 2026-10-29T07:38:23.212Z
   ================================================================ */

/* ================================================================
   MODAL SYSTEM — Industrial Cyber-Precision (PT Cloud V2)
   Covers: #jobModal, #plusModal, #uploadModal, #jobDetailModal,
           #ncInfoModal, #pdfViewModal, #imgViewModal
   All using CSS custom properties from pt-clean-template.css
   Design: Glassmorphism + Gradient header + Smooth backdrop
   ================================================================ */

/* ── Backdrop overlay ─────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(10, 15, 30, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  animation: ptModalFadeIn 0.22s ease both;
}

.modal.show,
.modal[style*="display: flex"],
.modal[style*="display:flex"] {
  display: flex !important;
}

/* Bootstrap modals (fade class) — keep native Bootstrap behaviour */
.modal.fade {
  display: none;
  animation: none;
}

.modal.fade.show {
  display: flex !important;
}

@keyframes ptModalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ── Modal content wrapper ────────────────────────────────────── */
.modal-content {
  background: #ffffff;
  border-radius: 16px;
  box-shadow:
    0 32px 80px rgba(10, 15, 50, 0.28),
    0 0 0 1px rgba(99, 102, 241, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  animation: ptModalSlideUp 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  position: relative;
  margin: auto;
}

/* Wide modal for file view */
.modal-dialog.modal-lg .modal-content {
  max-width: 820px;
}

@keyframes ptModalSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Modal header — gradient accent bar ──────────────────────── */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 18px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: 16px 16px 0 0;
  border-bottom: 2px solid rgba(99, 102, 241, 0.35);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

/* Coloured accent stripe — top of header */
.modal-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(90deg, #6366f1, #06b6d4, #6366f1);
  background-size: 200% 100%;
  animation: ptHeaderGlow 4s linear infinite;
}

@keyframes ptHeaderGlow {
  0% {
    background-position: 0% 0%;
  }

  100% {
    background-position: 200% 0%;
  }
}

/* ── Modal header title ───────────────────────────────────────── */
.modal-header h3,
.modal-header h5,
.modal-header .modal-title {
  font-family: var(--pt-font-display, 'Prompt', sans-serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: #f1f5f9;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.3;
}

.modal-header h3 .modal-title-icon,
.modal-header h5 .modal-title-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Icon accent colours per modal type */
#jobModal .modal-title-icon {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
}

#plusModal .modal-title-icon {
  background: linear-gradient(135deg, #0ea5e9, #0891b2);
}

#uploadModal .modal-title-icon {
  background: linear-gradient(135deg, #10b981, #059669);
}

#jobDetailModal .modal-title-icon {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

#ncInfoModal .modal-title-icon {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
}

#pdfViewModal .modal-title-icon {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

#imgViewModal .modal-title-icon {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

/* ── Close button ─────────────────────────────────────────────── */
.modal-header .close-modal,
.modal-header .btn-close {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  padding: 0;
  opacity: 1;
}

.modal-header .close-modal:hover,
.modal-header .btn-close:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
  transform: rotate(90deg);
}

/* Bootstrap btn-close override (white X icon) */
.modal-header .btn-close-white {
  filter: none;
  background-image: none;
}

.modal-header .btn-close-white::after {
  content: '\00D7';
  font-size: 20px;
  font-weight: 300;
  color: #94a3b8;
}

/* ── Modal navigation tabs (plusModal) ───────────────────────── */
.modal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 20px 0;
  border-bottom: 1px solid rgba(99, 102, 241, 0.12);
  background: #f8fafc;
}

.modal-nav .btn,
.modal-nav .btn-secondary {
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 8px 8px 0 0;
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-bottom: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  position: relative;
  bottom: -1px;
}

.modal-nav .btn:hover,
.modal-nav .btn-secondary:hover {
  background: rgba(99, 102, 241, 0.06);
  color: #6366f1;
  border-color: rgba(99, 102, 241, 0.3);
}

.modal-nav .btn.active,
.modal-nav .btn-secondary.active {
  background: #ffffff;
  color: #6366f1;
  border-color: rgba(99, 102, 241, 0.35);
  font-weight: 600;
  box-shadow: 0 -2px 0 0 #6366f1 inset;
}

/* Download template btn in nav — teal accent */
.modal-nav a .btn,
.modal-nav a .btn-secondary {
  color: #0891b2;
  border-color: rgba(6, 182, 212, 0.25);
}

.modal-nav a .btn:hover {
  background: rgba(6, 182, 212, 0.08);
  color: #0e7490;
}

/* ── Modal body ───────────────────────────────────────────────── */
.modal-body {
  padding: 24px;
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
}

/* File status indicators in uploadModal */
.file-buttons {
  background: rgba(248, 250, 252, 0.8);
  border: 1px solid rgba(99, 102, 241, 0.1);
  border-radius: 10px;
  padding: 12px 14px;
}

.file-buttons-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.view-btn-in-modal {
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.8rem;
  font-weight: 500;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.view-btn-in-modal:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.view-btn-in-modal:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* ── Form groups inside modals ────────────────────────────────── */
.modal-body .form-group {
  margin-bottom: 16px;
}

.modal-body .form-group label,
.modal-body .form-group .col-form-label {
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Required star */
.modal-body .form-group .text-danger,
.modal-body .form-group font[color="red"],
.modal-body .form-group font[style*="#ff0707"] {
  color: #ef4444 !important;
  font-weight: 700;
  font-size: 0.9em;
}

/* All inputs / selects */
.modal-body .form-control,
.modal-body .form-select,
.modal-body input[type="text"],
.modal-body input[type="number"],
.modal-body input[type="file"],
.modal-body select {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1.5px solid rgba(99, 102, 241, 0.2);
  border-radius: 9px;
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.88rem;
  color: #1e293b;
  background: rgba(248, 250, 252, 0.9);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  outline: none;
}

/* Number / Order code inputs — monospace slashed zero */
.modal-body #jobOrderNumber,
.modal-body #runjob,
.modal-body input[type="number"] {
  font-family: var(--pt-font-data, 'JetBrains Mono', monospace);
  font-variant-numeric: slashed-zero tabular-nums;
  letter-spacing: 0.03em;
}

/* Read-only fields */
.modal-body input[readonly] {
  background: rgba(241, 245, 249, 0.7);
  color: #64748b;
  cursor: not-allowed;
  border-style: dashed;
}

.modal-body .form-control:focus,
.modal-body .form-select:focus,
.modal-body input:not([readonly]):focus,
.modal-body select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14);
  background: #ffffff;
}

/* File input */
.modal-body input[type="file"] {
  padding: 7px 12px;
  cursor: pointer;
  min-height: 42px;
}

.modal-body input[type="file"]::-webkit-file-upload-button {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  border: none;
  padding: 5px 14px;
  border-radius: 6px;
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s;
  margin-right: 10px;
}

.modal-body input[type="file"]::file-selector-button {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  border: none;
  padding: 5px 14px;
  border-radius: 6px;
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.8rem;
  cursor: pointer;
  margin-right: 10px;
}

/* Priority select — colour indicators */
.modal-body select[name="Priority"] option[value="งานด่วน"] {
  color: #dc2626;
  font-weight: 600;
}

.modal-body select[name="Priority"] option[value="งานปกติ"] {
  color: #16a34a;
}

/* ── Form actions ─────────────────────────────────────────────── */
.modal-body .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(99, 102, 241, 0.1);
}

/* Primary submit */
.modal-body .submit-btn {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 9px;
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.22s;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.modal-body .submit-btn:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45);
}

.modal-body .submit-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

/* Cancel / secondary */
.modal-body .cancel-btn {
  background: rgba(100, 116, 139, 0.08);
  color: #64748b;
  border: 1.5px solid rgba(100, 116, 139, 0.25);
  padding: 10px 20px;
  border-radius: 9px;
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s;
}

.modal-body .cancel-btn:hover {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.35);
  color: #dc2626;
}

/* Upload submit button (green variant) */
#uploadForm .submit-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

#uploadForm .submit-btn:hover {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}

/* Form A-built submit (blue) */
#formAbuilt .submit-btn {
  background: linear-gradient(135deg, #0ea5e9, #0891b2);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.35);
}

#formAbuilt .submit-btn:hover {
  background: linear-gradient(135deg, #0891b2, #0e7490);
  box-shadow: 0 6px 18px rgba(14, 165, 233, 0.45);
}

/* Excel import button (emerald) */
#formSystem .submit-btn {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.35);
}

#formSystem .submit-btn:hover {
  background: linear-gradient(135deg, #16a34a, #15803d);
  box-shadow: 0 6px 18px rgba(34, 197, 94, 0.45);
}

/* ── Job Detail modal body ────────────────────────────────────── */
.job-detail-body {
  min-height: 160px;
  padding: 20px 24px;
}

.job-detail-container {
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.88rem;
  color: #334155;
  line-height: 1.6;
}

/* ── ncInfoModal success icon area ───────────────────────────── */
#ncInfoModal .modal-body {
  text-align: center;
  padding: 32px 24px;
}

#ncInfoModal .modal-body h5 {
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-weight: 600;
  color: #1e293b;
  margin: 12px 0 4px;
}

#ncInfoModal .modal-body p {
  color: #64748b;
  font-size: 0.85rem;
}

#ncInfoModal #ncFileName {
  font-family: var(--pt-font-data, 'JetBrains Mono', monospace);
  font-variant-numeric: slashed-zero;
  color: #6366f1;
}

/* ── Modal footer (Bootstrap modals) ─────────────────────────── */
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(99, 102, 241, 0.1);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #f8fafc;
  border-radius: 0 0 16px 16px;
}

.modal-footer .btn-secondary {
  background: rgba(100, 116, 139, 0.1);
  border: 1.5px solid rgba(100, 116, 139, 0.25);
  color: #64748b;
  border-radius: 8px;
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.85rem;
  padding: 7px 18px;
  min-height: 38px;
  transition: all 0.2s;
}

.modal-footer .btn-secondary:hover {
  background: rgba(100, 116, 139, 0.18);
  color: #334155;
}

/* ── Trigger button — neo-button-plus (สร้างใบ Order) ─────────── */
.neo-button-plus {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  border: none;
  border-radius: 10px;
  padding: 0 18px;
  height: 44px;
  min-width: 140px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 3px 12px rgba(99, 102, 241, 0.4);
}

.neo-button-plus .button-content {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
  color: #ffffff;
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

.neo-button-plus .button-content svg {
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.neo-button-plus .button-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.25) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

.neo-button-plus:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.55);
}

.neo-button-plus:hover .button-glow {
  opacity: 1;
}

.neo-button-plus:hover .button-content svg {
  transform: rotate(90deg);
}

.neo-button-plus:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* Ripple effect on click */
.neo-button-plus::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: inherit;
  opacity: 0;
  transform: scale(1);
  transition: opacity 0.4s, transform 0.4s;
}

.neo-button-plus:active::after {
  opacity: 1;
  transform: scale(1.15);
  transition: none;
}

/* ── Responsive modal ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .modal {
    padding: 0;
    align-items: flex-end;
  }

  .modal-content {
    max-width: 100%;
    width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    animation: ptModalSlideUpMobile 0.3s cubic-bezier(0.34, 1.3, 0.64, 1) both;
  }

  /* Bootstrap dialog modal on mobile — also slides from bottom */
  .modal.fade .modal-dialog {
    margin: 0;
    width: 100%;
    max-width: 100%;
    vertical-align: bottom;
  }

  .modal.fade .modal-content {
    border-radius: 20px 20px 0 0;
  }

  @keyframes ptModalSlideUpMobile {
    from {
      opacity: 0;
      transform: translateY(100%);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .modal-header {
    padding: 16px 18px 14px;
    border-radius: 20px 20px 0 0;
  }

  .modal-header::before {
    border-radius: 20px 20px 0 0;
  }

  .modal-header h3,
  .modal-header h5,
  .modal-header .modal-title {
    font-size: 0.95rem;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-nav {
    padding: 10px 14px 0;
    gap: 4px;
  }

  .modal-nav .btn,
  .modal-nav .btn-secondary {
    font-size: 0.78rem;
    padding: 6px 10px;
  }

  .modal-body .form-group label,
  .modal-body .form-group .col-form-label {
    font-size: 0.8rem;
    margin-bottom: 4px;
    padding-top: 0;
  }

  /* Bootstrap row layout — stack on mobile */
  .modal-body .form-group.row {
    display: block;
    margin-left: 0;
    margin-right: 0;
  }

  .modal-body .form-group .col-sm-3,
  .modal-body .form-group .col-sm-9 {
    width: 100%;
    padding: 0;
    flex: none;
    max-width: 100%;
  }

  .modal-body .form-group .col-sm-3 {
    margin-bottom: 4px;
  }

  .modal-body .form-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .modal-body .submit-btn,
  .modal-body .cancel-btn {
    width: 100%;
    justify-content: center;
    min-height: 46px;
    font-size: 0.92rem;
  }

  .neo-button-plus {
    height: 40px;
    min-width: 120px;
    padding: 0 14px;
  }

  .neo-button-plus .button-content span {
    font-size: 0.84rem;
  }
}

@media (max-width: 400px) {
  .modal-nav {
    flex-direction: column;
  }

  .modal-nav .btn,
  .modal-nav .btn-secondary {
    border-radius: 8px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.18);
    bottom: 0;
  }

  .modal-nav .btn.active,
  .modal-nav .btn-secondary.active {
    box-shadow: 2px 0 0 0 #6366f1 inset;
  }
}

/* === Modal helpers & form refinements ===*/

/* ================================================================
   MODAL — Additional helpers & modalmfg.php form styles
   ================================================================ */

/* ── .text-pt-blue — replaces inline style="color:#144993" ───── */
.text-pt-blue {
  color: #1a56db;
  font-weight: 600;
}

/* ── plusModal — max-width override (wider for complex form) ─── */
#plusModal .modal-content {
  max-width: 680px;
}

/* ── modalmfg form-page visibility toggle ─────────────────────── */
.form-page {
  display: none;
}

.form-page.active {
  display: block;
  animation: ptFadeIn 0.22s ease both;
}

@keyframes ptFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── modalmfg — Bootstrap row form adaptation ─────────────────── */
#plusModal .modal-body .form-group.row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 0;
}

#plusModal .modal-body .col-sm-3 {
  flex: 0 0 33.333%;
  max-width: 33.333%;
  padding-right: 12px;
  display: flex;
  align-items: center;
  min-height: 40px;
}

#plusModal .modal-body .col-sm-9 {
  flex: 0 0 66.667%;
  max-width: 66.667%;
}

/* Read-only job number in plusModal */
#runjob {
  font-family: var(--pt-font-data, 'JetBrains Mono', monospace);
  font-variant-numeric: slashed-zero tabular-nums;
  letter-spacing: 0.04em;
  background: rgba(241, 245, 249, 0.8) !important;
  color: #6366f1 !important;
  border-style: dashed !important;
  font-weight: 600;
}

/* Priority select visual cues */
#plusModal select[name="Priority"],
#formSystem select[name="Priority"] {
  border-left: 3px solid #6366f1;
}

/* ── File input section in modalmfg ────────────────────────────── */
#plusModal .input-group {
  position: relative;
}

#plusModal .input-group .form-control {
  border-radius: 9px;
}

/* ── jobModal — form-group simple layout (no Bootstrap row) ───── */
#jobModal .form-group {
  margin-bottom: 16px;
}

#jobModal .form-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.83rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
}

#jobModal .form-group label i {
  color: #6366f1;
  font-size: 0.78rem;
  width: 16px;
  text-align: center;
}

#jobModal .form-group .text-danger {
  color: #ef4444;
  font-weight: 700;
}

#jobModal .form-group input[type="text"] {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 1.5px solid rgba(99, 102, 241, 0.2);
  border-radius: 9px;
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.9rem;
  color: #1e293b;
  background: rgba(248, 250, 252, 0.9);
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

#jobModal #jobOrderNumber {
  font-family: var(--pt-font-data, 'JetBrains Mono', monospace);
  font-variant-numeric: slashed-zero tabular-nums;
  letter-spacing: 0.04em;
}

#jobModal input[type="text"]:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14);
  background: #ffffff;
}

/* jQuery UI datepicker trigger icon on #dueDate */
#jobModal #dueDate {
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}

/* ── uploadModal — file status section ────────────────────────── */
#uploadModal .file-buttons {
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.9), rgba(241, 245, 249, 0.7));
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

#uploadModal .file-buttons::before {
  content: '\f15b  ไฟล์ที่อัพโหลดแล้ว:';
  font-family: 'Font Awesome 5 Free', var(--pt-font-body, sans-serif);
  font-weight: 900;
  font-size: 0.75rem;
  color: #94a3b8;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 8px;
}

/* ── ncInfoModal body — success state ─────────────────────────── */
#ncInfoModal .modal-body {
  text-align: center;
  padding: 36px 24px;
}

#ncInfoModal .modal-body .fas.fa-check-circle {
  font-size: 3.5rem;
  color: #22c55e;
  display: block;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px rgba(34, 197, 94, 0.35));
}

/* ── pdfViewModal iframe wrapper ──────────────────────────────── */
#pdfViewModal .modal-body {
  padding: 0;
  overflow: hidden;
  border-radius: 0 0 16px 16px;
}

#pdfViewer {
  display: block;
  width: 100%;
  height: 520px;
  border: none;
  border-radius: 0 0 16px 16px;
}

/* ── imgViewModal image ───────────────────────────────────────── */
#imgViewModal .modal-body {
  padding: 16px;
  text-align: center;
  background: #0f172a;
  border-radius: 0 0 16px 16px;
}

#imgViewer {
  max-height: 520px;
  width: auto;
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ── Responsive — plusModal on tablet/mobile ──────────────────── */
@media (max-width: 768px) {
  #plusModal .modal-body .col-sm-3 {
    flex: 0 0 100%;
    max-width: 100%;
    padding-right: 0;
    min-height: auto;
    margin-bottom: 4px;
  }

  #plusModal .modal-body .col-sm-9 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  #plusModal .modal-body .form-group.row {
    display: block;
  }

  #pdfViewer {
    height: 320px;
  }
}

@media (max-width: 640px) {
  #plusModal .modal-content {
    max-width: 100%;
  }

  #pdfViewer {
    height: 260px;
  }

  #imgViewer {
    max-height: 300px;
  }
}

/* === PT Modal v3 — Upload & Viewer Modals === */

/* ================================================================
   PT MODAL SYSTEM v3 — Upload & File-View Modals
   Classes: .pt-modal, .pt-modal-content, .pt-modal-header, etc.
   Replaces Bootstrap .modal.fade .modal-dialog pattern for these
   specific modals only.
   ================================================================ */

/* ── Base pt-modal backdrop ──────────────────────────────────── */
.pt-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: rgba(8, 12, 28, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.pt-modal.pt-modal-open {
  display: flex !important;
  animation: ptBackdropIn 0.2s ease both;
}

@keyframes ptBackdropIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ── Base pt-modal-content ───────────────────────────────────── */
.pt-modal-content {
  background: #ffffff;
  border-radius: 18px;
  box-shadow:
    0 40px 100px rgba(8, 12, 40, 0.3),
    0 0 0 1px rgba(99, 102, 241, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  width: 100%;
  max-width: 560px;
  overflow: hidden;
  animation: ptContentIn 0.3s cubic-bezier(0.34, 1.4, 0.64, 1) both;
  display: flex;
  flex-direction: column;
  margin: auto;
}

@keyframes ptContentIn {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── pt-modal-header ─────────────────────────────────────────── */
.pt-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 16px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  position: relative;
  flex-shrink: 0;
}

/* Rainbow top stripe */
.pt-modal-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #6366f1 0%, #06b6d4 50%, #6366f1 100%);
  background-size: 200% 100%;
  animation: ptStripe 5s linear infinite;
}

@keyframes ptStripe {
  0% {
    background-position: 0% 0%;
  }

  100% {
    background-position: 200% 0%;
  }
}

/* ── Title wrap ──────────────────────────────────────────────── */
.pt-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.pt-modal-title {
  font-family: var(--pt-font-display, 'Prompt', sans-serif);
  font-size: 1rem;
  font-weight: 600;
  color: #f1f5f9;
  margin: 0;
  line-height: 1.2;
}

.pt-modal-subtitle {
  font-family: var(--pt-font-data, 'JetBrains Mono', monospace);
  font-variant-numeric: slashed-zero;
  font-size: 0.72rem;
  color: #64748b;
  margin: 2px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

/* ── Icon badge ──────────────────────────────────────────────── */
.pt-modal-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  color: #ffffff;
}

/* Per-modal icon colours */
.upload-icon {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.nc-icon-badge {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

.pdf-icon-badge {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.img-icon-badge {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

/* ── Close button ────────────────────────────────────────────── */
.pt-modal-close {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.pt-modal-close:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fca5a5;
  transform: rotate(90deg);
}

/* ── pt-modal-body ───────────────────────────────────────────── */
.pt-modal-body {
  padding: 22px 22px 6px;
  overflow-y: auto;
  flex: 1;
}

/* ── pt-modal-footer ─────────────────────────────────────────── */
.pt-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid rgba(99, 102, 241, 0.1);
  background: #f8fafc;
  flex-shrink: 0;
}

/* ── Shared button variants ──────────────────────────────────── */
.pt-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: 9px;
  border: none;
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.87rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
  transition: all 0.22s;
  text-decoration: none;
  white-space: nowrap;
}

.pt-btn-upload {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.pt-btn-upload:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.45);
}

.pt-btn-cancel {
  background: rgba(100, 116, 139, 0.08);
  color: #64748b;
  border: 1.5px solid rgba(100, 116, 139, 0.22);
}

.pt-btn-cancel:hover {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.3);
  color: #dc2626;
}

.pt-btn-close-view {
  background: rgba(99, 102, 241, 0.08);
  color: #6366f1;
  border: 1.5px solid rgba(99, 102, 241, 0.22);
}

.pt-btn-close-view:hover {
  background: rgba(99, 102, 241, 0.15);
  color: #4f46e5;
}

.pt-btn-download {
  background: rgba(6, 182, 212, 0.1);
  color: #0891b2;
  border: 1.5px solid rgba(6, 182, 212, 0.25);
  padding: 6px 14px;
  font-size: 0.82rem;
}

.pt-btn-download:hover {
  background: rgba(6, 182, 212, 0.2);
  color: #0e7490;
  transform: translateY(-1px);
}

/* ════════════════════════════════════════════════════════════════
   UPLOAD MODAL — specific styles
   ════════════════════════════════════════════════════════════════ */
.upload-modal-content {
  max-width: 580px;
}

/* Upload header colour */
.upload-header::before {
  background: linear-gradient(90deg, #10b981 0%, #06b6d4 50%, #10b981 100%);
  background-size: 200% 100%;
}

/* ── File status section (existing files) ────────────────────── */
.file-status-section {
  background: linear-gradient(135deg, rgba(241, 245, 249, 0.9), rgba(248, 250, 252, 0.7));
  border: 1px solid rgba(99, 102, 241, 0.1);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
}

.file-status-label {
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.file-status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

/* File status cards */
.file-status-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1.5px solid rgba(148, 163, 184, 0.25);
  background: #ffffff;
  cursor: pointer;
  transition: all 0.22s;
  min-height: 72px;
  position: relative;
  overflow: hidden;
}

.file-status-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.file-status-btn:not(:disabled):hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

/* Colour per type */
.file-status-nc {
  border-color: rgba(6, 182, 212, 0.3);
}

.file-status-nc:not(:disabled) {
  border-color: rgba(6, 182, 212, 0.5);
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.06), rgba(14, 165, 233, 0.03));
}

.file-status-pdf {
  border-color: rgba(239, 68, 68, 0.3);
}

.file-status-pdf:not(:disabled) {
  border-color: rgba(239, 68, 68, 0.5);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.06), rgba(220, 38, 38, 0.03));
}

.file-status-img {
  border-color: rgba(34, 197, 94, 0.3);
}

.file-status-img:not(:disabled) {
  border-color: rgba(34, 197, 94, 0.5);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.06), rgba(22, 163, 74, 0.03));
}

.file-status-icon {
  font-size: 20px;
  line-height: 1;
}

.file-status-nc .file-status-icon {
  color: #0891b2;
}

.file-status-pdf .file-status-icon {
  color: #dc2626;
}

.file-status-img .file-status-icon {
  color: #16a34a;
}

.file-status-text {
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.72rem;
  font-weight: 500;
  color: #475569;
}

.file-status-badge {
  font-family: var(--pt-font-data, 'JetBrains Mono', monospace);
  font-size: 0.62rem;
  padding: 2px 6px;
  border-radius: 20px;
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}

.file-status-btn:not(:disabled) .file-status-badge {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

/* ── Upload divider ──────────────────────────────────────────── */
.upload-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 16px;
}

.upload-divider::before,
.upload-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(99, 102, 241, 0.12);
}

.upload-divider span {
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.76rem;
  font-weight: 600;
  color: #94a3b8;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ── File upload rows ────────────────────────────────────────── */
.upload-file-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 6px;
}

.upload-file-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(99, 102, 241, 0.1);
  background: rgba(248, 250, 252, 0.7);
  transition: border-color 0.2s, background 0.2s;
}

.upload-file-row:has(input:focus-within) {
  border-color: rgba(99, 102, 241, 0.3);
  background: #ffffff;
}

.upload-file-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.84rem;
  font-weight: 600;
  color: #334155;
}

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

.nc-dot {
  background: #06b6d4;
  box-shadow: 0 0 6px rgba(6, 182, 212, 0.5);
}

.pdf-dot {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

.img-dot {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.upload-file-icon {
  font-size: 15px;
}

.nc-icon {
  color: #0891b2;
}

.pdf-icon {
  color: #dc2626;
}

.img-icon {
  color: #16a34a;
}

.upload-file-ext {
  font-family: var(--pt-font-data, 'JetBrains Mono', monospace);
  font-size: 0.65rem;
  color: #94a3b8;
  font-weight: 400;
}

/* ── Custom file input ───────────────────────────────────────── */
.upload-file-input {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.pt-file-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.pt-file-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 7px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #ffffff;
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 32px;
}

.pt-file-label:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.35);
}

.pt-file-name {
  font-family: var(--pt-font-data, 'JetBrains Mono', monospace);
  font-variant-numeric: slashed-zero;
  font-size: 0.72rem;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.pt-file-name.has-file {
  color: #16a34a;
  font-weight: 600;
}

/* ── pt-modal-actions (upload form) ─────────────────────────── */
.pt-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 0 4px;
  border-top: 1px solid rgba(99, 102, 241, 0.1);
  margin-top: 4px;
}

/* ════════════════════════════════════════════════════════════════
   NC INFO MODAL
   ════════════════════════════════════════════════════════════════ */
.nc-modal-content {
  max-width: 420px;
}

.nc-header::before {
  background: linear-gradient(90deg, #06b6d4 0%, #22d3ee 50%, #06b6d4 100%);
  background-size: 200% 100%;
}

.nc-info-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px 16px;
  text-align: center;
}

.nc-success-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(16, 185, 129, 0.06));
  border: 2px solid rgba(34, 197, 94, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  animation: ptSuccessPop 0.5s cubic-bezier(0.34, 1.6, 0.64, 1) 0.1s both;
}

.nc-success-icon .fas {
  font-size: 2.2rem;
  color: #22c55e;
  filter: drop-shadow(0 4px 12px rgba(34, 197, 94, 0.4));
}

@keyframes ptSuccessPop {
  from {
    opacity: 0;
    transform: scale(0.5);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.nc-success-title {
  font-family: var(--pt-font-display, 'Prompt', sans-serif);
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 16px;
}

.nc-file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(6, 182, 212, 0.06);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: 10px;
  padding: 12px 16px;
  width: 100%;
}

.nc-file-card-icon {
  font-size: 1.8rem;
  color: #0891b2;
  flex-shrink: 0;
}

.nc-file-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  text-align: left;
}

.nc-file-card-label {
  font-family: var(--pt-font-body, 'IBM Plex Sans Thai', sans-serif);
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nc-file-card-name {
  font-family: var(--pt-font-data, 'JetBrains Mono', monospace);
  font-variant-numeric: slashed-zero;
  font-size: 0.85rem;
  font-weight: 600;
  color: #0891b2;
  word-break: break-all;
}

/* ════════════════════════════════════════════════════════════════
   PDF & IMAGE VIEWER MODALS
   ════════════════════════════════════════════════════════════════ */
.viewer-modal-content {
  max-width: 900px;
  max-height: 92vh;
}

.pdf-viewer-content {
  border: 2px solid rgba(239, 68, 68, 0.15);
}

.img-viewer-content {
  border: 2px solid rgba(34, 197, 94, 0.15);
}

.viewer-header {
  position: relative;
}

.pdf-header::before {
  background: linear-gradient(90deg, #ef4444 0%, #f97316 50%, #ef4444 100%);
  background-size: 200% 100%;
}

.img-header::before {
  background: linear-gradient(90deg, #22c55e 0%, #06b6d4 50%, #22c55e 100%);
  background-size: 200% 100%;
}

/* viewer-header-actions (download + close) */
.viewer-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.viewer-filename {
  max-width: 320px;
}

/* ── Viewer body ─────────────────────────────────────────────── */
.pt-viewer-body {
  flex: 1;
  display: flex;
  align-items: stretch;
  background: #0f172a;
  overflow: hidden;
  min-height: 420px;
}

/* PDF iframe */
.pdf-viewer-body iframe {
  width: 100%;
  height: 100%;
  min-height: 500px;
  border: none;
  display: block;
}

/* Image viewer */
.img-viewer-body {
  align-items: center;
  justify-content: center;
  padding: 16px;
  min-height: 300px;
}

.pt-img-viewer {
  max-width: 100%;
  max-height: 66vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  display: block;
}

/* ── viewer footer ────────────────────────────────────────────── */
.viewer-footer {
  background: #1e293b;
  border-top: 1px solid rgba(99, 102, 241, 0.15);
}

.viewer-footer .pt-btn-close-view {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.25);
  color: #94a3b8;
}

.viewer-footer .pt-btn-close-view:hover {
  background: rgba(99, 102, 241, 0.22);
  color: #c7d2fe;
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .pt-modal {
    padding: 0;
    align-items: flex-end;
  }

  .pt-modal-content {
    max-width: 100%;
    width: 100%;
    border-radius: 20px 20px 0 0;
    animation: ptMobileIn 0.3s cubic-bezier(0.34, 1.3, 0.64, 1) both;
    max-height: 96vh;
  }

  @keyframes ptMobileIn {
    from {
      opacity: 0;
      transform: translateY(100%);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .pt-modal-header {
    border-radius: 20px 20px 0 0;
  }

  .upload-file-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .file-status-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .file-status-btn {
    padding: 8px 4px;
    min-height: 64px;
  }

  .pt-modal-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .pt-btn-upload,
  .pt-btn-cancel {
    width: 100%;
    justify-content: center;
  }

  .viewer-modal-content {
    max-height: 96vh;
    border-radius: 20px 20px 0 0;
  }

  .pt-viewer-body {
    min-height: 260px;
  }

  .pdf-viewer-body iframe {
    min-height: 280px;
  }

  .pt-img-viewer {
    max-height: 55vh;
  }

  .pt-modal-subtitle.viewer-filename {
    display: none;
  }
}

@media (max-width: 400px) {
  .file-status-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .file-status-btn {
    flex-direction: row;
    min-height: 48px;
    padding: 8px 12px;
    gap: 10px;
    justify-content: flex-start;
  }

  .file-status-icon {
    font-size: 16px;
  }
}

/* === Upload modal polish fixes === */

/* ================================================================
   Upload Modal — Custom file input fix & polish
   ================================================================ */

/* pt-file-input must be visually hidden but still accessible/clickable */
.pt-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* upload-file-row needs relative positioning for the hidden input */
.upload-file-input {
  position: relative;
}

/* file-status-btn active state (has file) */
.file-status-btn.has-file {
  border-color: rgba(34, 197, 94, 0.5) !important;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(16, 185, 129, 0.04)) !important;
}

.file-status-btn.has-file .file-status-badge {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
  font-weight: 600;
}

/* ncButton active (has NC file) */
#ncButton:not(:disabled) {
  cursor: pointer;
}

#ncButton:not(:disabled):hover {
  border-color: rgba(6, 182, 212, 0.7);
  box-shadow: 0 6px 16px rgba(6, 182, 212, 0.2);
}

#pdfButton:not(:disabled):hover {
  border-color: rgba(239, 68, 68, 0.7);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.2);
}

#imgButton:not(:disabled):hover {
  border-color: rgba(34, 197, 94, 0.7);
  box-shadow: 0 6px 16px rgba(34, 197, 94, 0.2);
}

/* pt-modal-body scrolling fix for upload (many rows) */
.upload-modal-content .pt-modal-body {
  max-height: calc(90vh - 80px);
  overflow-y: auto;
  padding-bottom: 0;
}

/* upload subtitle — JetBrains Mono for job ID */
#uploadModalJobId {
  font-family: var(--pt-font-data, 'JetBrains Mono', monospace);
  font-variant-numeric: slashed-zero tabular-nums;
  font-size: 0.76rem;
  color: #10b981;
  margin: 2px 0 0;
}

/* ── NC info modal footer alignment ─────────────────────────── */
.nc-modal-content .pt-modal-footer {
  justify-content: center;
}

/* ── Viewer modal — full-height flex body ─────────────────────── */
.viewer-modal-content {
  display: flex;
  flex-direction: column;
  max-height: 92vh;
}

.pdf-viewer-body {
  flex: 1;
  min-height: 460px;
}

.img-viewer-body {
  flex: 1;
  min-height: 300px;
}

/* Prevent layout shift when pdfViewer loads */
#pdfViewer {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 460px;
  border: none;
}

/* ── Download button in viewer header — align ─────────────────── */
.pt-btn-download {
  text-decoration: none;
}

.pt-btn-download i {
  font-size: 13px;
}

/* ── pt-modal-footer for nc and viewer ──────────────────────── */
.nc-modal-content .pt-modal-footer,
.viewer-modal-content .pt-modal-footer {
  background: #1e293b;
  border-top-color: rgba(255, 255, 255, 0.06);
}

/* ── Scroll thin for upload body ─────────────────────────────── */
.upload-modal-content .pt-modal-body::-webkit-scrollbar {
  width: 4px;
}

.upload-modal-content .pt-modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.upload-modal-content .pt-modal-body::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.25);
  border-radius: 2px;
}