/* systems design token system */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
  --font-family: 'Outfit', 'Sarabun', sans-serif;
  
  /* Color Palette - Premium Midnight Teal & Purple Accents */
  --bg-primary: #090e17;
  --bg-secondary: #0d1522;
  --bg-surface: #101c2c;
  --bg-surface-hover: #16273c;
  
  --color-primary: #10b981; /* Emerald / Cyan Green */
  --color-primary-hover: #059669;
  --color-primary-light: rgba(16, 185, 129, 0.12);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --border-color: rgba(56, 189, 248, 0.15);
  --border-focus: #10b981;
  
  /* Status Colors */
  --status-pending: #f59e0b;
  --status-pending-light: rgba(245, 158, 11, 0.15);
  --status-approved: #10b981;
  --status-approved-light: rgba(16, 185, 129, 0.15);
  --status-rejected: #ef4444;
  --status-rejected-light: rgba(239, 68, 68, 0.15);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  
  --sidebar-width: 260px;
  --topbar-height: 70px;
  
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

/* Utility classes */
.fade-in {
  animation: fadeIn var(--transition-normal);
}

.text-center { text-align: center; }
.hidden { display: none !important; }

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* ==================== Authentication Screen (DOK BUA WMS Modern Split-Card) ==================== */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 30px 20px;
  background: 
    radial-gradient(circle at 10% 20%, rgba(16, 185, 129, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(5, 150, 105, 0.12) 0%, transparent 50%),
    linear-gradient(135deg, #0b1320 0%, #0f172a 50%, #022c22 100%);
  position: relative;
  overflow-x: hidden;
}

.auth-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(to right, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  opacity: 0.7;
}

.auth-wrapper {
  width: 100%;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  position: relative;
  z-index: 1;
  animation: fadeIn 0.4s ease-out;
}

.auth-card-split {
  width: 100%;
  background: #ffffff;
  border-radius: 28px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35), 0 0 1px rgba(255, 255, 255, 0.5);
  display: grid;
  grid-template-columns: 360px 1fr;
  overflow: hidden;
  min-height: 560px;
}

/* --- Left Panel: Brand & Features (Emerald Green Theme) --- */
.auth-left-brand {
  background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 28%, #10b981 60%, #047857 100%);
  padding: 36px 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.auth-left-brand::after {
  content: '';
  position: absolute;
  bottom: -40px;
  right: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.auth-left-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.auth-brand-badge {
  margin-bottom: 12px;
}

.auth-brand-logo {
  max-height: 52px;
  max-width: 140px;
  object-fit: contain;
}

.auth-brand-title-wrap {
  margin-bottom: 10px;
}

.auth-brand-main {
  font-size: 2rem;
  font-weight: 900;
  color: #0f172a;
  line-height: 1.1;
  letter-spacing: -0.5px;
  margin: 0;
}

.auth-brand-wms-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-brand-wms {
  font-size: 2.35rem;
  font-weight: 900;
  color: #059669;
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.auth-brand-wms-icon {
  font-size: 1.5rem;
  color: #059669;
}

.auth-brand-divider {
  width: 44px;
  height: 3px;
  background: #10b981;
  border-radius: 2px;
  margin-bottom: 10px;
}

.auth-brand-desc {
  margin-bottom: 26px;
}

.auth-desc-th {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.4;
}

.auth-desc-en {
  font-size: 0.72rem;
  font-weight: 500;
  color: #64748b;
  letter-spacing: 0.2px;
}

/* 4 Feature Items */
.auth-features-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
}

.auth-feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-feature-icon {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  color: #059669;
  font-size: 0.95rem;
}

.auth-feature-text {
  display: flex;
  flex-direction: column;
}

.auth-feature-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.auth-feature-subtitle {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.2;
}

/* --- Right Panel: Login Form (Clean Minimalist White) --- */
.auth-right-form {
  padding: 36px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #ffffff;
}

.auth-top-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.auth-lang-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 5px 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.auth-form-center {
  max-width: 360px;
  width: 100%;
  margin: 0 auto;
  text-align: center;
}

.auth-security-badge {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px auto;
  background: #f0fdf4;
  border: 2px solid #bbf7d0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #059669;
  font-size: 1.45rem;
  box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.08);
}

.auth-welcome-title {
  font-size: 1.38rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 4px 0;
}

.auth-welcome-subtitle {
  font-size: 0.82rem;
  color: #64748b;
  margin: 0 0 22px 0;
}

.auth-form-body {
  text-align: left;
}

.auth-field-group {
  margin-bottom: 16px;
}

.auth-input-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
  display: block;
}

.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: 14px;
  color: #94a3b8;
  font-size: 0.95rem;
  pointer-events: none;
}

.auth-modern-input {
  width: 100%;
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1.5px solid #e2e8f0 !important;
  border-radius: 10px !important;
  padding: 11px 40px 11px 40px !important;
  font-size: 0.88rem !important;
  transition: all 0.2s ease;
}

.auth-modern-input:focus {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
  outline: none;
}

.auth-modern-input::placeholder {
  color: #94a3b8;
  font-size: 0.82rem;
}

.auth-pwd-toggle {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-pwd-toggle:hover {
  color: #059669;
}

.auth-form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 14px 0 20px 0;
  font-size: 0.78rem;
}

.auth-remember-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #475569;
  cursor: pointer;
  font-weight: 500;
}

.auth-remember-wrap input[type="checkbox"] {
  accent-color: #059669;
  width: 15px;
  height: 15px;
  border-radius: 4px;
  cursor: pointer;
}

.auth-forgot-link {
  color: #059669;
  text-decoration: none;
  font-weight: 600;
}

.auth-forgot-link:hover {
  text-decoration: underline;
}

.auth-submit-btn {
  width: 100%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 10px !important;
  padding: 13px !important;
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}

.auth-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45) !important;
}

.auth-submit-btn:active {
  transform: translateY(1px);
}

.auth-footer-info {
  font-size: 0.72rem;
  color: #94a3b8;
  text-align: center;
  line-height: 1.4;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .auth-card-split {
    grid-template-columns: 1fr;
    border-radius: 20px;
  }
  .auth-left-brand {
    padding: 26px 20px;
  }
  .auth-right-form {
    padding: 28px 20px;
  }
  .auth-features-list {
    margin-top: 18px;
  }
}

/* Form Styles */
.form-group {
  margin-bottom: 20px;
  position: relative;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.95rem;
  transition: var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  gap: 8px;
}

.btn-primary {
  background-color: var(--color-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-surface-hover);
}

.btn-danger {
  background-color: var(--status-rejected);
  color: #ffffff;
}

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

.btn-full {
  width: 100%;
}

.error-message {
  color: var(--status-rejected);
  background-color: var(--status-rejected-light);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 20px;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* App Shell Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform var(--transition-normal);
}

.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  height: 40px;
}

.sidebar-brand-name {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  color: var(--text-primary);
}

.sidebar-menu {
  list-style: none;
  padding: 20px 14px;
  flex-grow: 1;
  overflow-y: auto;
}

.sidebar-item {
  margin-bottom: 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  gap: 14px;
  cursor: pointer;
}

.sidebar-link i {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
}

.sidebar-link:hover {
  background-color: var(--bg-surface);
  color: var(--text-primary);
}

.sidebar-link.active {
  background-color: var(--color-primary);
  color: #ffffff;
}

.sidebar-link.active i {
  color: #ffffff;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border-color);
  background-color: rgba(0, 0, 0, 0.15);
}

.user-profile-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  background-color: var(--color-primary-light);
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.user-info {
  overflow: hidden;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-role-badge {
  font-size: 0.75rem;
  color: var(--color-primary);
  background-color: var(--color-primary-light);
  padding: 2px 8px;
  border-radius: 20px;
  display: inline-block;
  font-weight: 600;
  text-transform: uppercase;
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background: linear-gradient(90deg, #1f0e34 0%, #0d1a29 50%, #0d222e 100%);
  border-bottom: 1px solid rgba(139, 92, 246, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  position: sticky;
  top: 0;
  z-index: 99;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.hamburger-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  display: none;
}

.page-title-container {
  display: flex;
  align-items: center;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
}

/* Content Panels */
.content-body {
  padding: 30px;
  flex-grow: 1;
}

.content-panel {
  display: none;
  animation: fadeIn var(--transition-normal);
}

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

/* Dashboard Styles */
.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  margin-bottom: 25px;
}

@media (max-width: 1300px) {
  .dashboard-stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 900px) {
  .dashboard-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .dashboard-stats-grid {
    grid-template-columns: 1fr;
  }
}

.dashboard-stat-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.dashboard-stat-box:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-box-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.stat-box-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.stat-box-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  line-height: 1.2;
}

.stat-box-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.stat-box-footer {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Color styles */
.stat-box-purple .stat-box-icon { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.stat-box-purple { border-top: 3px solid #8b5cf6; }

.stat-box-green .stat-box-icon { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.stat-box-green { border-top: 3px solid #10b981; }

.stat-box-blue .stat-box-icon { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.stat-box-blue { border-top: 3px solid #3b82f6; }

.stat-box-orange .stat-box-icon { background: rgba(249, 115, 22, 0.15); color: #fb923c; }
.stat-box-orange { border-top: 3px solid #f97316; }

.stat-box-yellow .stat-box-icon { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.stat-box-yellow { border-top: 3px solid #f59e0b; cursor: pointer; }

.stat-box-warning .stat-box-icon { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.stat-box-warning { border-top: 3px solid #ef4444; cursor: pointer; }

.stat-box-red .stat-box-icon { background: rgba(185, 28, 28, 0.15); color: #fca5a5; }
.stat-box-red { border-top: 3px solid #b91c1c; cursor: pointer; }

@media (max-width: 992px) {
  .dashboard-charts-row {
    grid-template-columns: 1fr !important;
  }
}

/* Dashboard Section Layout */
.dashboard-section {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

@media (max-width: 1024px) {
  .dashboard-section {
    grid-template-columns: 1fr;
  }
}

.panel-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

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

.panel-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Responsive Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.925rem;
}

.table th, .table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.table th {
  background-color: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  font-weight: 600;
}

.table tr:last-child td {
  border-bottom: none;
}

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

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 20px;
}

.badge-pending {
  background-color: var(--status-pending-light);
  color: var(--status-pending);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-approved {
  background-color: var(--status-approved-light);
  color: var(--status-approved);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-rejected {
  background-color: var(--status-rejected-light);
  color: var(--status-rejected);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-sales {
  background-color: rgba(99, 102, 241, 0.12);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

/* Transaction Entry Styles */
.form-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 200px;
}

/* Stock Balance View */
.stock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.product-card {
  background-color: #0b1329;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  display: flex;
  flex-direction: column;
  padding: 10px;
}

.product-card:hover {
  transform: translateY(-4px);
  border-color: rgba(6, 182, 212, 0.4);
  box-shadow: 0 8px 28px rgba(6, 182, 212, 0.15);
}

.product-image-container {
  height: 190px;
  background-color: #050b18;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform var(--transition-normal);
}

.product-card:hover .product-image {
  transform: scale(1.04);
}

/* Bottom Overlay Bar inside Image Frame (Picture 1 Style) */
.product-image-overlay-bar {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  z-index: 5;
}

.product-code-pill {
  background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.76rem;
  padding: 3px 10px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(6, 182, 212, 0.4);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.product-barcode-pill {
  background: rgba(15, 23, 42, 0.85);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-weight: 600;
  font-size: 0.72rem;
  font-family: var(--font-mono, monospace);
  padding: 3px 9px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.product-no-image {
  color: var(--text-muted);
  font-size: 2.5rem;
}

.product-details {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-code {
  font-size: 0.75rem;
  color: var(--color-primary);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.product-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.85em;
  color: var(--text-primary);
}

.product-stock-line {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border-color);
  font-size: 0.85rem;
}

.product-stock-line:last-child {
  border-bottom: none;
}

.product-stock-value {
  font-weight: 600;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  padding: 20px;
  backdrop-filter: blur(5px);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

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

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.35rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background-color: rgba(0, 0, 0, 0.05);
}

/* Aliases สำหรับ Modal ที่ใช้ชื่อ class ว่า modal-backdrop/modal-box */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(5px);
}

.modal-backdrop.hidden {
  display: none !important;
}

.modal-box {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn 0.2s ease;
}

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

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

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--status-rejected);
}


/* Sidebar overlay on mobile */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 98;
  display: none;
}

/* Mobile Responsiveness Rules */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .sidebar-overlay.active {
    display: block;
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .topbar {
    padding: 0 20px;
  }
  
  .hamburger-btn {
    display: block;
  }
  
  .content-body {
    padding: 20px;
  }
  
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  
  .form-row .form-group {
    width: 100%;
    margin-bottom: 15px;
  }
}

/* Requisition Form Items List */
.requisition-items-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 25px;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.req-items-table {
  width: 100%;
  margin-bottom: 20px;
}

.req-items-table th, .req-items-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

.req-items-table th {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.btn-remove-item {
  background: none;
  border: none;
  color: var(--status-rejected);
  cursor: pointer;
  font-size: 1.1rem;
}

.btn-remove-item:hover {
  color: #dc2626;
}

/* File Picker Styling */
.file-picker-container {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-fast);
  background-color: rgba(255, 255, 255, 0.01);
}

.file-picker-container:hover {
  border-color: var(--color-primary);
  background-color: rgba(16, 185, 129, 0.02);
}

.file-picker-icon {
  font-size: 2.5rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.file-picker-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.file-picker-preview {
  max-width: 100%;
  max-height: 200px;
  border-radius: var(--radius-sm);
  margin-top: 15px;
}

/* Order Grid Table Excel styling */
.order-grid-table {
  border-collapse: collapse;
}

.order-grid-table th {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 700;
  text-align: center;
  font-size: 0.85rem;
  border: 1px solid var(--border-color);
}

.order-grid-table td {
  padding: 0 !important; /* Let inputs fill the entire cell */
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
}

.order-grid-input {
  width: 100%;
  height: 38px;
  border: none;
  background-color: transparent;
  color: var(--text-primary);
  padding: 8px 10px;
  font-family: var(--font-family);
  font-size: 0.9rem;
  transition: background-color var(--transition-fast);
}

.order-grid-input:focus {
  outline: none;
  background-color: rgba(16, 185, 129, 0.05);
  box-shadow: inset 0 0 0 1px var(--color-primary);
}

/* Readonly fields styling to mimic Excel */
.order-grid-input[readonly] {
  background-color: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  cursor: not-allowed;
}

.order-grid-select {
  width: 100%;
  height: 38px;
  border: none;
  background-color: transparent;
  color: var(--text-primary);
  padding: 8px 10px;
  font-family: var(--font-family);
  font-size: 0.9rem;
  cursor: pointer;
}

.order-grid-select option,
select option {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  padding: 8px 10px;
}

.order-grid-select:focus {
  outline: none;
  background-color: rgba(16, 185, 129, 0.05);
}

/* Merged cells vertical center */
.order-grid-table td.merged-cell {
  background-color: rgba(255, 255, 255, 0.01);
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  vertical-align: middle;
  padding: 8px 10px !important;
  font-size: 0.95rem;
}

/* Row hover highlight */
.order-grid-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
}

.order-grid-table tr:hover td.merged-cell {
  background-color: rgba(255, 255, 255, 0.03);
}

/* Row numbers centering */
.order-grid-row-num {
  text-align: center;
  font-weight: 700;
  color: var(--text-muted);
  background-color: rgba(255, 255, 255, 0.02);
  user-select: none;
}



/* Product Database Management styling */
.form-input[disabled] {
  background-color: var(--bg-primary) !important;
  color: var(--text-secondary) !important;
  cursor: not-allowed;
  opacity: 0.7;
}

#product-modal .modal-body {
  padding-right: 10px;
}

/* Mobile Simulator Mockup Frame (iPhone 15 Pro Style - Premium Metallic Frame) */
.mobile-simulator-active {
  width: 380px !important;
  max-width: 92vw !important;
  height: 820px !important;
  max-height: 88vh !important;
  margin: 2vh auto !important;
  
  /* กรอบไทเทเนียมสมจริง 3 มิติ */
  border: 12px solid #0f172a !important;
  outline: 4px solid #334155 !important; 
  border-radius: 46px !important;
  box-shadow: 
    0 25px 60px rgba(0, 0, 0, 0.9), 
    0 0 0 12px #020617,
    0 0 0 14px rgba(51, 65, 85, 0.5),
    inset 0 0 12px rgba(0, 0, 0, 0.9) !important;
  
  overflow: hidden !important;
  position: relative !important;
  background-color: var(--bg-primary) !important;
  padding-top: 36px !important;
  padding-bottom: 24px !important;
}

/* ปรับองค์ประกอบภายในให้พอดีกับจอภาพมือถือ */
.mobile-simulator-active,
.mobile-simulator-active * {
  font-size: 12px !important;
}

.mobile-simulator-active .page-title {
  font-size: 14px !important;
  font-weight: 700 !important;
}

.mobile-simulator-active .panel-title,
.mobile-simulator-active h3,
.mobile-simulator-active h4 {
  font-size: 13px !important;
  font-weight: 600 !important;
}

.mobile-simulator-active .form-label {
  font-size: 11px !important;
  font-weight: 500 !important;
  margin-bottom: 3px !important;
}

.mobile-simulator-active .form-input,
.mobile-simulator-active select,
.mobile-simulator-active input,
.mobile-simulator-active .btn {
  height: 34px !important;
  min-height: 34px !important;
  padding: 4px 8px !important;
  font-size: 12px !important;
  border-radius: 8px !important;
}

.mobile-simulator-active .panel-card {
  padding: 12px !important;
  margin-bottom: 12px !important;
}

/* รอยบาก Dynamic Island / Notch ด้านบนมือถือ */
.mobile-simulator-active::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 24px;
  background-color: #020617;
  border-radius: 20px;
  z-index: 999999;
  pointer-events: none;
  box-shadow: 0 0 2px rgba(255, 255, 255, 0.1);
}

/* iOS Home Indicator ขีดล่างสุด */
.mobile-simulator-active::after {
  content: '';
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 130px;
  height: 5px;
  background-color: rgba(255, 255, 255, 0.4);
  border-radius: 3px;
  z-index: 999999;
  pointer-events: none;
}

/* iOS Status Bar */
.simulated-status-bar {
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 6px 24px 2px 24px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  height: 36px;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.75rem;
}
.mobile-simulator-active .simulated-status-bar {
  display: flex !important;
}

.mobile-simulator-active .sidebar {
  display: none !important;
}

.mobile-simulator-active .main-content {
  margin-left: 0 !important;
  width: 100% !important;
  height: calc(100% - 60px) !important;
  overflow-y: auto !important;
  padding: 12px 12px 75px 12px !important;
  -webkit-overflow-scrolling: touch;
}

/* แถบเมนูด้านล่าง Mobile Bottom Navigation Bar */
.mobile-bottom-navbar {
  display: none;
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  height: 58px;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 99999;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
}

.mobile-simulator-active .mobile-bottom-navbar {
  display: flex !important;
}

@media (max-width: 768px) {
  .mobile-bottom-navbar {
    display: flex !important;
    position: fixed;
    bottom: 0;
    z-index: 1000;
  }
  .main-content {
    padding-bottom: 70px !important;
  }
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.65rem !important;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 4px;
  border-radius: 8px;
  transition: all 0.2s ease;
  flex: 1;
  text-align: center;
}

.mobile-nav-item i {
  font-size: 1.15rem !important;
  transition: transform 0.2s ease;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
  color: #10b981 !important;
}

.mobile-nav-item.active i {
  transform: translateY(-2px);
}

/* แผงปุ่มลอยสำหรับสลับจอกลับคอมพิวเตอร์นอกจอจำลอง */
.simulator-floating-controls {
  display: none;
  position: fixed;
  top: 40px;
  right: 40px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px;
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.5);
  z-index: 9999999;
  width: 220px;
}

/* ปรับพื้นหลังบอดี้เวลาเข้าโหมดจำลองเพื่อให้เห็น iPhone เด่นชัด */
body.mobile-simulator-body-active {
  background: radial-gradient(circle at center, #1e293b 0%, #020617 100%) !important;
  overflow: auto;
}

/* Mobile Touch Optimizations */
@media (max-width: 768px), .mobile-simulator-active {
  #current-time-display {
    display: none !important;
  }

  .form-input, .btn, .file-picker-container, .form-input-sm {
    min-height: 38px !important; /* ปรับลดจาก 48px ให้ดูสะอาดตาและเหมาะสมกับสัดส่วนหน้าจอ */
    font-size: 0.88rem !important;
  }
  
  .form-label {
    font-weight: 500 !important; /* ลดความหนาของตัวหนังสือหัวข้อ */
    font-size: 0.85rem !important;
    margin-bottom: 4px !important;
  }

  .content-panel h3, .content-panel h4 {
    font-weight: 600 !important; /* ปรับลดระดับความหนาหัวข้อ */
    font-size: 1.1rem !important;
  }
  
  .qc-warehouse-badge {
    padding: 6px 12px !important;
    font-size: 0.82rem !important;
  }

/* ============================================================
   🌟 Dashboard New Widget Styles
   ============================================================ */

/* Task Mini Cards (งานรอดำเนินการ) */
.dash-task-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 14px 8px 12px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  min-height: 90px;
}

.dash-task-mini:hover {
  background: rgba(255,255,255,0.06);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  border-color: rgba(255,255,255,0.12);
}

.dash-task-mini-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.dash-task-mini-count {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.dash-task-mini-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.2;
}

/* 🌟 Mobile Table Auto-fit Optimization - บังคับทุกคอลัมน์ให้แสดงพอดีในหน้าจอเดียว */

/* ===== บล็อก 1: โหมดจำลองมือถือ (Mobile Simulator) ===== */
.mobile-simulator-active .table-responsive {
  overflow-x: hidden !important;
  width: 100% !important;
}

.mobile-simulator-active table {
  width: 100% !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
}

.mobile-simulator-active table th {
  padding: 4px 2px !important;
  font-size: 9px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  text-align: center !important;
  word-break: break-word !important;
  white-space: normal !important;
  background: #0f172a !important;
}

.mobile-simulator-active table td {
  padding: 4px 2px !important;
  font-size: 9.5px !important;
  vertical-align: middle !important;
  line-height: 1.2 !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
}

/* คอลัมน์ 1: วันที่/เวลา */
.mobile-simulator-active table th:nth-child(1),
.mobile-simulator-active table td:nth-child(1) {
  width: 15% !important; font-size: 8px !important; text-align: center !important;
}
/* คอลัมน์ 2: เลขบิล/อ้างอิง */
.mobile-simulator-active table th:nth-child(2),
.mobile-simulator-active table td:nth-child(2) {
  width: 17% !important; font-size: 8.5px !important;
}
/* คอลัมน์ 3: รหัสสินค้า */
.mobile-simulator-active table th:nth-child(3),
.mobile-simulator-active table td:nth-child(3) {
  width: 14% !important; font-size: 8.5px !important;
}
/* คอลัมน์ 4: ชื่อสินค้า */
.mobile-simulator-active table th:nth-child(4),
.mobile-simulator-active table td:nth-child(4) {
  width: 22% !important; font-size: 9px !important; font-weight: 600 !important;
}
/* คอลัมน์ 5: เลข PD/จำนวน */
.mobile-simulator-active table th:nth-child(5),
.mobile-simulator-active table td:nth-child(5) {
  width: 12% !important; font-size: 9.5px !important; text-align: right !important;
}
/* คอลัมน์ 6: หน่วย */
.mobile-simulator-active table th:nth-child(6),
.mobile-simulator-active table td:nth-child(6) {
  width: 6% !important; font-size: 8px !important; text-align: center !important;
}
/* คอลัมน์ 7: สถานะ */
.mobile-simulator-active table th:nth-child(7),
.mobile-simulator-active table td:nth-child(7) {
  width: 10% !important; text-align: center !important;
}
/* คอลัมน์ 8+: การจัดการ */
.mobile-simulator-active table th:nth-child(8),
.mobile-simulator-active table td:nth-child(8),
.mobile-simulator-active table th:nth-child(9),
.mobile-simulator-active table td:nth-child(9),
.mobile-simulator-active table th:nth-child(10),
.mobile-simulator-active table td:nth-child(10) {
  width: 10% !important; text-align: center !important;
}

/* ซ่อนคอลัมน์หมายเหตุใน QC Inventory (คอลัมน์ 8 ของตารางนี้) */
.mobile-simulator-active #panel-qc-inventory table th:nth-child(8),
.mobile-simulator-active #panel-qc-inventory table td:nth-child(8) {
  display: none !important;
}

/* ซ่อนคอลัมน์หมายเหตุใน Pending Print (คอลัมน์ 3 รหัสสินค้า ไม่ซ่อน - แต่ซ่อน PD Batch ช่วย) */

/* ย่อขนาดปุ่มและตราสถานะในตารางโหมดมือถือ */
.mobile-simulator-active table td .badge {
  padding: 2px 4px !important;
  font-size: 8px !important;
  border-radius: 4px !important;
  white-space: nowrap !important;
  line-height: 1.2 !important;
}

.mobile-simulator-active table td .btn {
  padding: 3px 5px !important;
  font-size: 8.5px !important;
  height: 24px !important;
  min-height: 24px !important;
  border-radius: 4px !important;
  margin: 0 1px !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 2px !important;
}

/* ซ่อนปุ่มประวัติ (btn-outline-info) บนจอจิ๋ว - คงเหลือแค่ปุ่มโอนย้าย */
.mobile-simulator-active table td .btn-outline-info,
.mobile-simulator-active table td [onclick*="openLotTransferHistoryModal"],
.mobile-simulator-active table td [onclick*="openQCInventoryHistoryModal"] {
  display: none !important;
}

/* ===== บล็อก 2: หน้าจอขนาดเล็กจริง (Responsive <=768px) ===== */
@media (max-width: 768px) {
  .table-responsive {
    overflow-x: hidden !important;
    width: 100% !important;
  }

  table { width: 100% !important; table-layout: fixed !important; }

  table th {
    padding: 4px 2px !important;
    font-size: 9px !important;
    font-weight: 700 !important;
    text-align: center !important;
    white-space: normal !important;
    word-break: break-word !important;
  }

  table td {
    padding: 4px 2px !important;
    font-size: 9.5px !important;
    vertical-align: middle !important;
    word-break: break-word !important;
  }

  table td .btn {
    padding: 3px 5px !important;
    font-size: 8.5px !important;
    height: 24px !important;
    min-height: 24px !important;
  }
}

  /* แปลงตารางบันทึกคลังเป็นสไตล์การ์ด */
  #entry-grid-tbody tr {
    display: block !important;
    background-color: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    margin-bottom: 12px !important;
    padding: 12px !important;
    position: relative !important;
  }

  #entry-grid-tbody td {
    display: block !important;
    border: none !important;
    padding: 4px 0 !important;
    text-align: left !important;
  }

  #entry-grid-tbody td::before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: var(--text-secondary);
    display: inline-block;
    width: 100px;
  }

  /* ซ่อนหัวตารางเดสก์ท็อป */
  #entry-grid-container table thead {
    display: none !important;
  }

  /* ย้ายปุ่มลบถังขยะไปอยู่มุมขวาบนการ์ด */
  #entry-grid-tbody td:last-child {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    width: auto !important;
    padding: 0 !important;
  }
  
  #entry-grid-tbody td:last-child::before {
    display: none !important;
  }
}

/* Custom Autocomplete Suggestions Dropdown */
.search-suggestions-wrapper {
  position: relative;
  width: 100%;
}

.search-suggestions-container {
  position: absolute;
  top: 105%;
  left: 0;
  width: 100%;
  max-height: 280px;
  overflow-y: auto;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
}

.search-suggestion-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background-color var(--transition-fast);
  text-align: left;
}

.search-suggestion-item:last-child {
  border-bottom: none;
}

.search-suggestion-item:hover {
  background-color: var(--bg-surface-hover);
}

.search-suggestion-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.search-suggestion-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* QC Distribution Badges */
.qc-warehouse-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.85rem;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-fast);
}

.qc-warehouse-badge:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--color-primary);
}

.qc-warehouse-badge:has(input:checked) {
  background-color: var(--color-primary-light);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

.qc-warehouse-badge input[type="checkbox"] {
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* Custom Autocomplete Suggestions Dropdown */
.search-suggestions-wrapper {
  position: relative;
  width: 100%;
}

.search-suggestions-container {
  position: absolute;
  top: 105%;
  left: 0;
  width: 100%;
  max-height: 280px;
  overflow-y: auto;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
}

.search-suggestion-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background-color var(--transition-fast);
  text-align: left;
}

.search-suggestion-item:last-child {
  border-bottom: none;
}

.search-suggestion-item:hover {
  background-color: var(--bg-surface-hover);
}

.search-suggestion-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.search-suggestion-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   🖨️ 7. PRINT MEDIA STYLES (Direct same-page print)
   ========================================================================== */
#sales-print-area {
  display: none;
}

@media print {
  html, body {
    background: #ffffff !important;
    background-color: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 13px !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }
  
  body > *:not(#sales-print-area) {
    display: none !important;
  }
  
  #sales-print-area {
    display: block !important;
    position: relative !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    opacity: 1 !important;
    visibility: visible !important;
    padding: 0.4cm 0.5cm !important;
    margin: 0px !important;
  }

  /* Reset print borders and spacing */
  #sales-print-area table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-bottom: 20px !important;
  }

  #sales-print-area th, 
  #sales-print-area td {
    border: 1px solid #000000 !important;
    padding: 6px 8px !important;
    color: #000000 !important;
    background-color: transparent !important;
  }

  #sales-print-area th {
    background-color: #f3f4f6 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .customer-print-block {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    border: 1.5px solid #000000 !important;
    padding: 12px !important;
    border-radius: 6px !important;
    margin-top: 20px !important;
    background-color: #ffffff !important;
  }

  .print-footer-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 15px !important;
    margin-top: 30px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .signature-box {
    border: 1px solid #000000 !important;
    text-align: center !important;
    padding: 10px !important;
    height: 105px !important;
    border-radius: 6px !important;
  }

  .signature-line {
    border-bottom: 1px solid #000000 !important;
    margin: 20px auto 5px auto !important;
    width: 85% !important;
  }

  /* Colors adjustments for print */
  .highlight-yellow {
    background-color: #fef3c7 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .highlight-blue {
    background-color: #eff6ff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* Collapsible Database Cards & Profile Styles */
.collapsible-card {
  transition: all 0.3s ease;
  background-color: #0d1927;
  border: 1px solid rgba(14, 165, 233, 0.22);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-md);
}

.collapsible-header {
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  transition: background-color 0.2s ease;
}

.collapsible-header:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

.collapsible-header:hover .toggle-icon {
  color: var(--color-primary) !important;
}

.badge-info {
  background-color: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.badge-secondary {
  background-color: rgba(100, 116, 139, 0.18);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.35);
}

/* Sticky Table Header & Scroll Container */
.sticky-table-container {
  max-height: calc(100vh - 270px);
  min-height: 400px;
  overflow-y: auto;
  overflow-x: auto;
  position: relative;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(56, 189, 248, 0.2);
  background-color: #0b1420;
}

.sticky-table-container table {
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.sticky-table-container th {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #0a131e !important;
  color: #94a3b8;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  border-bottom: 2px solid rgba(56, 189, 248, 0.25) !important;
}

.sticky-table-container tbody tr {
  background-color: #0d1724;
  transition: background-color 0.15s ease;
}

.sticky-table-container tbody tr:nth-child(even) {
  background-color: #0c1520;
}

.sticky-table-container tbody tr:hover {
  background-color: #122236 !important;
}

.sticky-table-container td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
  vertical-align: middle;
}

/* Red Highlight for Auto-filled Price in Sales Requisition Grid */
.price-auto-highlight {
  border: 2px solid #ef4444 !important;
  color: #ef4444 !important;
  background-color: rgba(239, 68, 68, 0.12) !important;
  font-weight: 800 !important;
}

/* ==========================================================================
   📊 8. SALES ACCOUNTING EXCEL TAB & MATRIX STYLES
   ========================================================================== */
.excel-sheet-tabs-container {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 12px;
  background-color: #0f172a;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  margin-top: 15px;
}

.excel-sheet-tab {
  padding: 9px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  background-color: #1e293b;
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.excel-sheet-tab:hover {
  background-color: #334155;
  color: #ffffff;
}

.excel-sheet-tab.active {
  background-color: #facc15;
  color: #0f172a;
  border-color: #eab308;
  box-shadow: 0 -3px 10px rgba(250, 204, 21, 0.4);
}

.excel-sheet-tab.tab-summary {
  background-color: #581c87;
  color: #e9d5ff;
}

.excel-sheet-tab.tab-summary.active {
  background-color: #a855f7;
  color: #ffffff;
  border-color: #9333ea;
  box-shadow: 0 -3px 10px rgba(168, 85, 247, 0.4);
}

.cell-excel-green-header {
  background-color: #84cc16 !important;
  color: #0f172a !important;
  font-weight: 800 !important;
}

.cell-excel-yellow-header {
  background-color: #facc15 !important;
  color: #0f172a !important;
  font-weight: 800 !important;
}

.cell-excel-yellow-bg {
  background-color: #fef08a !important;
  color: #0f172a !important;
  font-weight: 800 !important;
}

.cell-excel-blue-bg {
  background-color: #bfdbfe !important;
  color: #0f172a !important;
  font-weight: 800 !important;
}

.cell-excel-green-total {
  background-color: #a3e635 !important;
  color: #0f172a !important;
  font-weight: 800 !important;
}


@media (max-width: 768px) {
  .approve-filter-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Print Styles for Pallet Stickers */
@media print {
  body {
    background-color: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  body * {
    visibility: hidden !important;
  }
  #print-stickers-section, #print-stickers-section * {
    visibility: visible !important;
  }
  #print-stickers-section {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    display: block !important;
  }
  .sticker-page {
    page-break-after: always !important;
    page-break-inside: avoid !important;
    break-after: page !important;
    width: 100mm !important;
    height: 150mm !important;
    box-sizing: border-box !important;
    padding: 8mm !important;
    border: 2px solid #000000 !important;
    margin: 0 auto 10px auto !important;
    font-family: 'Sarabun', sans-serif !important;
    color: #000000 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
  }
}

/* Hide from screen by default */
#print-stickers-section {
  display: none;
}

/* ==========================================================================
   Custom iOS Premium Entry Form Styling
   ========================================================================== */
.custom-entry-cards {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1.3fr;
  gap: 10px;
  margin-top: 8px;
}

.entry-card {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 86px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.entry-card:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(16, 185, 129, 0.2);
}

.entry-card.active {
  border-color: #10b981 !important;
  background: rgba(16, 185, 129, 0.08) !important;
  box-shadow: 0 0 0 1px #10b981, 0 10px 15px -3px rgba(16, 185, 129, 0.15);
}

.entry-card-icon {
  font-size: 1.3rem;
  color: #94a3b8;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28px;
}

.entry-card.active .entry-card-icon {
  color: #10b981;
}

.entry-card-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #f1f5f9;
  line-height: 1.2;
}

.entry-card-sub {
  font-size: 0.65rem;
  color: #64748b;
  margin-top: 3px;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-card.active .entry-card-sub {
  color: #34d399;
}

/* Scan Input Container */
.scan-search-container {
  position: relative;
  display: flex;
  align-items: center;
}

.scan-search-container .search-icon {
  position: absolute;
  left: 14px;
  color: #64748b;
  font-size: 0.95rem;
  pointer-events: none;
}

.scan-search-container .btn-scan-qr {
  position: absolute;
  right: 6px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #10b981;
  padding: 5px 9px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  height: 28px;
}

.scan-search-container .btn-scan-qr:hover {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
}

.scan-search-container .form-input {
  padding-left: 38px !important;
  padding-right: 48px !important;
}

/* Mobile-Friendly Grids */
.sim-form-row-three {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.sim-form-row-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

@media (max-width: 480px), .mobile-simulator-active {
  .custom-entry-cards {
    gap: 8px;
  }
  
  .entry-card {
    min-height: 78px;
    padding: 8px 6px;
  }
  
  .entry-card-icon {
    font-size: 1.15rem;
    margin-bottom: 4px;
  }
  
  .entry-card-title {
    font-size: 0.75rem;
  }
  
  .entry-card-sub {
    font-size: 0.6rem;
  }
}

/* ==========================================================================
   Steppers, Select Icons, Empty States, and Submit buttons
   ========================================================================== */
/* ปุ่มประวัติขวาบนของ Topbar */
.btn-topbar-history {
  display: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  align-items: center;
  gap: 5px;
  position: absolute;
  right: 12px;
}

.mobile-simulator-active .btn-topbar-history {
  display: flex !important;
}

/* ตกแต่ง Dropdown ให้มีไอคอนซ้ายมือ */
.select-with-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.select-with-icon-wrapper .select-icon-left {
  position: absolute;
  left: 12px;
  color: #10b981;
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 10;
}

.custom-select-icon {
  padding-left: 32px !important;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 14px !important;
}

/* เครื่องมือเพิ่ม/ลดจำนวน (Quantity Stepper +/-) */
.qty-stepper-container {
  display: flex;
  align-items: center;
  background: rgba(30, 41, 59, 0.5);
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  height: 32px;
  width: 100%;
}

.qty-stepper-container .stepper-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.1rem;
  font-weight: 700;
  width: 32px;
  height: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  user-select: none;
}

.qty-stepper-container .stepper-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.qty-stepper-container .stepper-btn:active {
  background: rgba(255, 255, 255, 0.1);
}

.qty-stepper-container .qty-input {
  border: none !important;
  background: transparent !important;
  text-align: center !important;
  padding: 0 !important;
  height: 100% !important;
  margin: 0 !important;
  flex: 1;
  width: 30px !important;
  font-weight: 700 !important;
  color: #ffffff !important;
}

/* ซ่อนลูกศรขึ้นลงของอินพุตตัวเลขใน Stepper */
.qty-stepper-container input::-webkit-outer-spin-button,
.qty-stepper-container input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.qty-stepper-container input[type=number] {
  -moz-appearance: textfield;
}

/* กล่องรายการว่างเปล่าแบบ Mockup (Empty State) */
.empty-state-entry-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 10px;
  text-align: center;
}

.empty-state-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 1.5rem;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

/* ปรับแต่งแถวปุ่มบันทึกด้านล่าง */
.entry-submit-buttons-row {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 12px;
  margin-top: 24px;
}

.btn-submit-batch {
  background: #10b981 !important;
  color: #020617 !important;
  font-weight: 700 !important;
  border: none !important;
  border-radius: 12px !important;
  height: 38px !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25) !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-submit-batch:hover {
  background: #34d399 !important;
}

.btn-clear-batch {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #cbd5e1 !important;
  border-radius: 12px !important;
  height: 38px !important;
  font-weight: 500 !important;
}

.btn-clear-batch:hover {
  background: rgba(255, 255, 255, 0.1) !important;
}

/* ==================== Custom Action Dropdown for Requisition Summary ==================== */
.req-dropdown-container {
  position: relative;
  display: inline-block;
}

.req-dropdown-menu {
  position: absolute;
  top: 105%;
  right: 0;
  min-width: 320px;
  background: #0f172a;
  border: 1.5px solid rgba(56, 189, 248, 0.3);
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.7), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none;
  overflow: hidden;
  padding: 6px;
  animation: fadeIn 0.15s ease-out;
}

.req-dropdown-menu.show {
  display: block;
}

.req-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: #f8fafc;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.req-dropdown-item:hover {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.req-dropdown-item.btn-opt-update {
  color: #fbbf24;
}

.req-dropdown-item.btn-opt-update:hover {
  background: rgba(245, 158, 11, 0.2);
  color: #fef08a;
}

.req-dropdown-item.btn-opt-new {
  color: #34d399;
}

.req-dropdown-item.btn-opt-new:hover {
  background: rgba(16, 185, 129, 0.2);
  color: #a7f3d0;
}

.req-dropdown-item i {
  font-size: 1.1rem;
}

