@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

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

#paymentHistoryModal .payment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 25px;
  border-bottom: 1px solid #f0f0f0;
  gap: 15px;
  flex-wrap: wrap;
  transition: background 0.2s;
}

#paymentHistoryModal .payment-item:hover {
  background: #f8f9ff;
}

#paymentHistoryModal .payment-item:last-child {
  border-bottom: none;
}

#paymentHistoryModal .payment-info {
  flex: 1;
  min-width: 200px;
}

#paymentHistoryModal .payment-plan {
  font-weight: 600;
  color: #333;
  font-size: 15px;
  margin-bottom: 4px;
}

#paymentHistoryModal .payment-details {
  font-size: 13px;
  color: #666;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

#paymentHistoryModal .payment-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#paymentHistoryModal .status-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

#paymentHistoryModal .btn-view-bill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

#paymentHistoryModal .btn-view-bill:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.35);
}

#paymentHistoryModal .empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #888;
}

#paymentHistoryModal .empty-state i {
  color: #ddd;
  margin-bottom: 15px;
}

input[type="file"] {
  font-family: 'Kanit', sans-serif;
}

input[type="file"]::file-selector-button {
  font-family: 'Kanit', sans-serif;
}

#activationContainer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  /* จัดกึ่งกลาง */
  gap: 15px;
  /* เว้นระยะระหว่าง card */
}

.activation-card {
  display: flex;
  align-items: flex-start;
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  flex: 1 1 300px;
  max-width: 500px;
  gap: 10px;
  margin-bottom: 15px;
  transition: transform 0.2s;
}

.activation-card:hover {
  transform: translateY(-3px);
  /* effect hover */
}

.activation-card img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
}

.activation-info h4 {
  margin: 0 0 5px 0;
  font-size: 16px;
}

.activation-info p {
  margin: 0 0 5px 0;
  font-size: 14px;
  color: #333;
}

.activation-info ul {
  padding-left: 18px;
  margin: 0;
}

.activation-info ul li {
  font-size: 14px;
  color: #555;
  margin: 2px 0;
}



#editSlugModal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- ปรับปรุง CSS ใหม่ --- */
:root {
  --line-green: #06C755;
  --line-green-dark: #05b24f;
  --overlay: rgba(0, 0, 0, 0.55);
}

/* พื้นหลังทึบ */
.popup-overlay {
  position: fixed;
  inset: 0;
  /* top:0; right:0; bottom:0; left:0; */
  background: var(--overlay);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 20px;
}

/* กล่อง popup */
.popup-content {
  background: #fff;
  border-radius: 12px;
  max-width: 900px;
  width: 100%;
  max-height: 85vh;
  /* ใช้ viewport height ให้แน่นอน */
  overflow-y: auto;
  text-align: center;
  padding: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  animation: popupFade .26s ease-out;
}

/* รูปภายใน popup */
.popup-content img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
  margin: 0 auto;
}

/* Footer: ปุ่มใหญ่ + controls */
.popup-footer {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  /* ปุ่มบน, controls ข้างล่าง */
  align-items: center;
  gap: 12px;
}

/* ปุ่ม LINE */
.line-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;

  background: linear-gradient(180deg, #06C755 0%, #05b24f 100%);
  color: #fff;
  text-decoration: none;

  padding: 14px 28px;
  border-radius: 14px;
  width: 100%;
  max-width: 320px;

  box-shadow: 0 8px 20px rgba(6, 199, 85, 0.25);
  transition: all 0.25s ease;
  margin-bottom: 10px;

  /* 👇 ใส่ animation heartbeat */
  animation: heartbeat 1.6s infinite;
}

/* hover ก็ยังมี effect */
.line-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 28px rgba(6, 199, 85, 0.35);
  filter: brightness(1.05);
}

/* ข้อความในปุ่ม */
.line-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.line-sub {
  font-size: 14px;
  font-weight: 400;
  opacity: 0.95;
}

/* 👇 heartbeat animation */
@keyframes heartbeat {

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

  15% {
    transform: scale(1.08);
  }

  30% {
    transform: scale(0.98);
  }

  45% {
    transform: scale(1.1);
  }

  60% {
    transform: scale(0.97);
  }

  75% {
    transform: scale(1.05);
  }
}


/* controls: checkbox + ปิด */
.popup-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 14px;
  color: #333;
}

/* checkbox label */
.hide-today {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.hide-today input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  transform: translateY(1px);
}

/* ปุ่มปิด (คงสีแดงเดิม แต่ปรับสไตล์ให้ทันสมัย) */
.close-btnp {
  background: #ef4444;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: transform .12s ease, box-shadow .12s ease;
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.12);
}

.close-btnp:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(239, 68, 68, 0.14);
}

.close-btnp:active {
  transform: translateY(0);
}

/* การแสดงผลบนมือถือ ปรับขนาดปุ่มเล็กลงเล็กน้อย */
@media (max-width: 480px) {
  .popup-content {
    padding: 12px;
  }

  .line-btn {
    font-size: 16px;
    padding: 10px 20px;
  }

  .popup-controls {
    gap: 8px;
    font-size: 13px;
  }
}

/* desktop: ถ้าต้องการ ให้ controls ชิดขวาและปุ่มชิดซ้าย (อันนี้เป็นทางเลือก)
   ถ้าไม่อยากใช้ ให้ลบทิ้งส่วนนี้ */
@media (min-width: 900px) {
  /* ตัวอย่าง ถ้าต้องการวางปุ่มกับ controls เป็นแถวเดียวกัน
  .popup-footer { flex-direction: row; justify-content: space-between; align-items: center; gap: 18px; }
  .line-btn { order: 0; }
  .popup-controls { order: 1; }
  */
}

/* animation */
@keyframes popupFade {
  from {
    opacity: 0;
    transform: translateY(6px) scale(.995);
  }

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


.user-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-card {
  background: #fff;
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);

  justify-content: space-between;
  align-items: center;
}

.user-info {
  font-size: 14px;
}

.user-info strong {
  font-size: 16px;
  color: #333;
}

.days-left {
  color: #e67e22;
  font-weight: bold;
}

.sendBtn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: #3498db;
  color: white;
  font-size: 14px;
  transition: 0.2s;
}

.sendBtn:hover {
  background: #2980b9;
}


.file-item {
  transition: background-color 0.2s;
}

.file-item:hover {
  background-color: #f8f9fa;
}

.file-actions {
  transition: opacity 0.2s ease;
  opacity: 0;
}

.file-item:hover .file-actions {
  display: block !important;
  animation: fadeInDelay 0.1s ease 0.1s forwards;
}

@keyframes fadeInDelay {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Status Badges */
.status-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  display: inline-block;
  min-width: 80px;
}

.status-pending {
  background: #fff3cd;
  color: #856404;
}

.status-assigned {
  background: #cce5ff;
  color: #004085;
}

.status-in_progress {
  background: #e7f3ff;
  color: #0056b3;
}

.status-completed {
  background: #d4edda;
  color: #155724;
}

.status-failed {
  background: #f8d7da;
  color: #721c24;
}

/* Priority Badges */
.priority-low {
  background: #d1ecf1;
  color: #0c5460;
}

.priority-medium {
  background: #fff3cd;
  color: #856404;
}

.priority-high {
  background: #f8d7da;
  color: #721c24;
}

/* Detail View */
.detail-card {
  background: linear-gradient(135deg, #fff, #f8f9ff);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #f0f0f0;
}

.detail-title {
  font-size: 28px;
  font-weight: 700;
  color: #333;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.detail-item {
  background: #f8f9ff;
  padding: 20px;
  border-radius: 12px;
  border-left: 4px solid #667eea;
}

.detail-item h4 {
  font-size: 14px;
  font-weight: 600;
  color: #666;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-item p {
  font-size: 16px;
  color: #333;
  font-weight: 500;
}

/* Logs */
.logs-container {
  background: #fff;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.log-item {
  display: flex;
  align-items: center;
  padding: 15px;
  margin-bottom: 10px;
  background: #f8f9ff;
  border-radius: 10px;
  border-left: 4px solid #667eea;
}

.log-item:last-child {
  margin-bottom: 0;
}

.log-icon {
  font-size: 20px;
  margin-right: 15px;
  color: #667eea;
}

.log-content {
  flex: 1;
}

.log-time {
  font-size: 12px;
  color: #666;
  margin-bottom: 5px;
}

.log-text {
  font-size: 14px;
  color: #333;
}

/* Filter Section */
.filter-section {
  background: linear-gradient(135deg, #fff, #f8f9ff);
  padding: 20px;
  border-radius: 15px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.filter-section label {
  font-weight: 600;
  color: #333;
}

.filter-section select {
  padding: 10px 15px;
  border: 2px solid #e0e6ff;
  border-radius: 8px;
  font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .filter-section {
    flex-direction: column;
    align-items: flex-start;
  }

  .page {
    padding: 20px;
  }
}

/* Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

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

.page {
  animation: fadeIn 0.5s ease;
}

/* Recent Repairs List */
.recent-repairs {
  max-height: 400px;
  overflow-y: auto;
}

.recent-repair-item {
  background: #f8f9ff;
  border: 1px solid #e0e6ff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 15px;
  transition: all 0.3s ease;
}

.recent-repair-item:hover {
  border-color: #667eea;
  transform: translateX(5px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.1);
}

.recent-repair-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.recent-repair-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.recent-repair-date {
  font-size: 12px;
  color: #666;
}

.recent-repair-desc {
  font-size: 14px;
  color: #555;
  margin-bottom: 10px;
  line-height: 1.5;
}

.recent-repair-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Table Styles */
/* Table Styles */
.table-container {
  background: #fff;
  border-radius: 15px;
  overflow-x: auto;
  /* ✅ เปลี่ยนจาก hidden เป็น auto */
  overflow-y: hidden;
  /* กัน scrollbar แนวตั้งโผล่ */
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  margin-top: 20px;
  width: 100%;
}

/* กัน table บีบในจอเล็ก */
.table {
  width: 100%;
  min-width: 900px;
  /* ✅ บังคับให้กว้างกว่าจอเล็ก → scrollbar จะทำงาน */
  border-collapse: collapse;
}


.table thead {
  background: linear-gradient(135deg, #667eea, #764ba2);
}

.table thead th {
  color: white;
  padding: 20px;
  font-weight: 600;
  text-align: left;
}

.table tbody td {
  padding: 15px 20px;
  border-bottom: 1px solid #f0f0f0;
}

.table tbody tr:hover {
  background: #f8f9ff;
}



.chart-card {
  background: linear-gradient(135deg, #fff, #f8f9ff);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.chart-card h3 {
  font-size: 24px;
  font-weight: 600;
  color: #333;
  margin-bottom: 20px;
  text-align: center;
}

/* Form Styles */
.repair-form {
  background: linear-gradient(135deg, #fff, #f8f9ff);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08);
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
  font-size: 16px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 15px;
  border: 2px solid #e0e6ff;
  border-radius: 12px;
  font-size: 16px;
  transition: all 0.3s ease;
  background: #fff;
}

.form-group input[type="url"] {
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input[type="url"]:focus {
  outline: none;
  border-color: #6f6a8c;
  box-shadow: 0 0 4px rgba(111, 106, 140, 0.4);
}

.error-message {
  color: #d33;
  font-size: 13px;
  margin-top: 4px;
  display: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

/* Product Selection */
.products-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 15px;
  margin: 20px 0;
  max-height: 300px;
  overflow-y: auto;
  padding: 15px;
  background: #f8f9ff;
  border-radius: 12px;
  border: 2px dashed #e0e6ff;
}

.product-item {
  background: #fff;
  border: 2px solid #e0e6ff;
  border-radius: 10px;
  padding: 15px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.product-item:hover {
  border-color: #667eea;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.15);
}

.product-item.selected {
  border-color: #667eea;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

/* card */
.card {
  width: 160px;
  padding: 20px;
  text-align: center;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  background: #fff;
  transition: 0.2s;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.icon {
  font-size: 28px;
  margin-bottom: 10px;
}

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

.terms-body ol {
  padding-left: 20px;
  margin: 0;
}

.terms-body li {
  margin-bottom: 12px;
  font-size: 15px;
  color: #444;
  line-height: 1.6;
}

.terms-body li strong {
  color: #333;
  font-weight: 700;
}

.terms-body li em {
  color: #555;
  font-style: normal;
}

.terms-body li u {
  text-decoration: underline;
  text-decoration-color: #764ba2;
  font-weight: 500;
}

.terms-body li .highlight {
  color: #c62828;
  font-weight: 600;
}

* {
  font-family: 'Kanit', sans-serif;
  text-align: center;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body,
html {
  background: radial-gradient(circle at center, #F0FFFF, #F5FFFA, transparent);
  background-attachment: fixed;
  min-height: 100vh;
  color: #333;
  overscroll-behavior: contain;
  height: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.profile-card {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 20px 25px;
  max-width: 500px;
  margin: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  font-family: 'Kanit', sans-serif;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.label {
  font-weight: 600;
  color: #333;
}

.value {
  color: #555;
  text-align: right;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: #444;
}

.note {
  font-size: 13px;
  color: #999;
  margin-top: 10px;
}

.header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 20px;
  border-radius: 15px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 24px;
  font-weight: bold;
  color: #667eea;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.expire-badge {
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
}

.expire-active {
  background: #059669;
  /* ✅ Emerald green - contrast ratio 4.6:1 */
  color: white;
}

.expire-warning {
  background: #e65100;
  /* ✅ เข้มขึ้นจาก #FF9800 เพื่อ contrast ดีขึ้น */
  color: white;
  animation: pulse 2s infinite;
}

.expire-expired {
  background: #F44336;
  color: white;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }

  100% {
    opacity: 1;
  }
}

.main-content {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  flex: 1;
  /* ดันให้กินพื้นที่เหลือ */
}

footer {
  margin-top: auto;
  /* ให้ footer ไปชิดด้านล่าง */
}

/* ซ่อน login form ตั้งแต่แรก */
.login-form {
  display: none;
}

/* แสดงเมื่อมี class show */
.login-form.show {
  display: block;
}

.page-container {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.page-container.loaded {
  opacity: 1;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.nav-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
  border-bottom: 2px solid #f0f0f0;
}

.nav-tab {
  padding: 12px 24px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: #666;
  transition: all 0.3s ease;
}

.nav-tab.active {
  color: #667eea;
  border-bottom-color: #667eea;
}

.nav-tab:hover {
  color: #667eea;
  background: rgba(102, 126, 234, 0.1);
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
}

.btn {
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  font-size: 16px;

  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, #4a6ee0, #3b52b2);
  color: white;

}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn-success {
  background: #4CAF50;
  color: white;
}

.btn-warning {
  background: #FF9800;
  color: white;
}

.btn-danger {
  background: #F44336;
  color: white;
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.file-list {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.file-item {
  background: #f8f9fa;
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #e0e0e0;
  transition: all 0.3s ease;
}

.file-item:hover {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.file-header {
  display: flex;
  justify-content: between;
  align-items: center;
  margin-bottom: 15px;
}

.file-name {
  font-weight: 600;
  color: #333;
  flex: 1;
}

.file-date {
  color: #666;
  font-size: 14px;
}

.file-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.qr-container {
  text-align: center;
  margin: 20px 0;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  overflow: hidden;
  /* Prevent scrollbar on modal overlay */
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  position: relative;
  background: white;
  padding: 30px;
  border-radius: 15px;
  max-width: 500px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  overflow-x: hidden;
  /* Scrollbar styling for webkit browsers */
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.modal-content::-webkit-scrollbar {
  width: 6px;
}

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

.modal-content::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e0e0e0;
}

.modal-title {
  font-size: 20px;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
}

.login-form {
  max-width: 400px;
  margin: 50px auto;
  background: rgba(255, 255, 255, 0.95);
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.forgot-password-form {
  max-width: 400px;
  margin: 50px auto;
  background: rgba(255, 255, 255, 0.95);
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.login-title {
  text-align: center;
  margin-bottom: 30px;
  font-size: 28px;
  font-weight: bold;
  color: #667eea;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: linear-gradient(135deg, #4a6ee0, #3b52b2);
  color: white;
  padding: 25px;
  border-radius: 10px;
  text-align: center;
}

.stat-number {
  font-size: 32px;
  font-weight: bold;
  margin-bottom: 10px;
}

.stat-label {
  font-size: 14px;
  opacity: 0.9;
}

.subscription-plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.plan-card {
  background: #f8f9fa;
  padding: 25px;
  border-radius: 10px;
  border: 2px solid #e0e0e0;
  text-align: center;
  transition: all 0.3s ease;
}

.plan-card:hover {
  border-color: #667eea;
  transform: translateY(-5px);
}

.plan-name {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 10px;
  color: #333;
}

.plan-price {
  font-size: 24px;
  font-weight: bold;
  color: #667eea;
  margin-bottom: 15px;
}

.plan-features {
  list-style: none;
  margin-bottom: 20px;
}

.plan-features li {
  margin-bottom: 8px;
  color: #666;
}

.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 20px;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  z-index: 999999;
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.notification.show {
  opacity: 1 !important;
  transform: scale(1) !important;
  pointer-events: auto !important;
  display: block !important;
}

.notification.success {
  background: #4CAF50;
}

.notification.error {
  background: #F44336;
}

.notification.warning {
  background: #FF9800;
}

.notification.info {
  background-color: #d1ecf1;
  color: #0c5460;
}

.upload-area {
  border: 2px dashed #667eea;
  border-radius: 10px;
  padding: 40px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.upload-area:hover {
  background: rgba(102, 126, 234, 0.1);
}

.upload-area.dragover {
  background: rgba(102, 126, 234, 0.2);
  border-color: #764ba2;
}

@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: 15px;
  }

  .nav-tabs {
    flex-wrap: wrap;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .subscription-plans {
    grid-template-columns: 1fr;
  }
}

.storage-box {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-width: 500px;
  margin: 20px auto;
  font-family: 'Segoe UI', sans-serif;
}

.progress-container {
  background: #eee;
  border-radius: 8px;
  overflow: hidden;
  height: 24px;
  margin: 10px 0;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, #00c6ff, #0072ff);
  transition: width 0.5s ease;
}

.usage-text {
  text-align: center;
  font-weight: bold;
  color: #333;
}

#usersList {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 100%;
  overflow-x: auto;
}

.user-card {
  background: #ffffff;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  cursor: pointer;
}

.user-card:hover {
  background: #f1f9ff;
}

.user-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

#filesList,
#usersList,
#paymentsList {
  max-height: 70vh;
  overflow-y: auto;
  overflow-anchor: none;
  padding-right: 10px;
}

#filesList::-webkit-scrollbar,
#usersList::-webkit-scrollbar,
#paymentsList::-webkit-scrollbar {
  width: 6px;
}

#filesList::-webkit-scrollbar-thumb,
#usersList::-webkit-scrollbar-thumb,
#paymentsList::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

#createProduct,
#upload,
#files,
#customQR,
#admin,
#repairsDashboard,
#createRepair,
#repairDetail,
#partsDashboard {
  max-width: 700px;
  margin: 30px auto;
  /* background: #fff; */
  padding: 30px;
  border-radius: 12px;
  /* box-shadow: 0 2px 10px rgba(0,0,0,0.1); */
  font-family: 'Kanit', sans-serif;
}

#createProduct h2 {
  text-align: center;
  color: #333;
  margin-bottom: 20px;
}

#createProduct form div {
  margin-bottom: 15px;
  /* ระยะห่างระหว่างแต่ละบรรทัด */
}


#createProduct label {
  font-weight: bold;
  margin-bottom: 4px;
  color: #444;
}

#createProduct input[type="text"],
#createProduct input[type="date"],
#createProduct select {
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 14px;
  width: 100%;
}

#createProduct input[type="file"] {
  font-size: 14px;

}

#createProduct .add-category-btn {
  margin-top: -10px;
  margin-bottom: 10px;
  align-self: flex-start;
  background-color: #06b6d4;
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 13px;
  cursor: pointer;
}

#createProduct .add-category-btn:hover {
  background-color: #0891b2;
}

#pdfTypeContainer select {
  margin-top: 5px;
  margin-bottom: 10px;
  width: 100%;
  padding: 6px;
}

#createProduct button[type="submit"] {
  padding: 12px;
  background-color: #4CAF50;
  color: white;
  font-size: 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 10px;
}

#createProduct button[type="submit"]:hover {
  background-color: #3fa846;
}

.required {
  color: red;
  margin-left: 4px;
  font-weight: bold;
}

#editProductModal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  /* default ซ่อนไว้ก่อน */
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

#editProductModal .modal-content {
  position: relative;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

}

#editProductModal h3 {
  margin-top: 0;
  font-size: 20px;
  margin-bottom: 16px;
  color: #333;
}

#editProductModal label {
  display: block;
  margin-top: 12px;
  font-weight: bold;
  color: #444;
}

#editProductModal input,
#editProductModal select {
  width: 100%;
  padding: 8px 10px;
  margin-top: 4px;
  border-radius: 6px;
  border: 1px solid #ccc;
  box-sizing: border-box;
  font-size: 14px;
}

#editProductModal .btn {
  margin-top: 20px;
  margin-right: 10px;
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
}

#editProductModal .btn-primary {
  background-color: #3b82f6;
  color: white;
  border: none;
}

#editProductModal .btn-secondary {
  background-color: #e5e7eb;
  color: #111;
  border: none;
}

@keyframes fadeInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

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

#confirmModal,
#deleteModal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

/*
#confirmModal , #deleteModal .modal-content {
  
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.2);
  text-align: center;
}

#confirmModal ,#deleteModal .btn {
  margin: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
*/
#addCategoryModal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

#addCategoryModal .modal-content {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

#addCategoryModal input[type="text"] {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  margin-top: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#addCategoryModal input[type="text"]:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
  outline: none;
}

.filter-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  justify-content: center;
}

.filter-btn {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  color: #374151;
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.filter-btn:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
  color: #111827;
}

.filter-btn.active {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
}

#deletePaymentModal {
  position: fixed;
  z-index: 2000;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

#deletePaymentModal .delete-modal-box {
  background: white;
  border-radius: 12px;
  padding: 24px 28px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  animation: fadeInScale 0.25s ease;
  text-align: center;
}

#deletePaymentModal .delete-modal-message {
  font-size: 1.1rem;
  margin-bottom: 24px;
  color: #111827;
}

#deletePaymentModal .delete-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Animation */
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

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

#serialModal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

#serialModal .modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 25px 30px;
  max-width: 900px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  font-family: 'Kanit', sans-serif;
}

#serialModal table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1px;
  font-size: 14px;
}

#serialModal th,
#serialModal td {
  border-bottom: 1px solid #eee;
  padding: 2px 10px;
  text-align: left;
}

#serialModal .summary-box {
  background: #f1f1f1;
  border-radius: 8px;
  padding: 10px 15px;
  margin-top: 15px;
  font-size: 14px;
}

#serialModal .summary-box strong {
  color: #2d3436;
}

#serialModal .form-section {
  margin-top: 20px;
}

#serialModal input[type="date"],
#serialModal input[type="text"],
#serialModal input[type="number"] {
  padding: 5px 10px;
  margin: 5px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
}

#serialModal button {
  padding: 6px 12px;
  font-size: 14px;
  margin-top: 10px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}

#serialModal .btn-primary {
  background-color: #22a6b3;
  color: white;
}

#serialModal .btn-secondary {
  background-color: #dcdde1;
  color: #2d3436;
}

#serialModal td.sn-location {
  max-width: 10px;
  /* ปรับได้ตามต้องการ */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}




@media print {
  body * {
    visibility: hidden;
  }

  #printableArea,
  #printableArea * {
    visibility: visible;
  }

  #printableArea {
    position: absolute;
    top: 0;
    left: 0;
    width: 210mm;
    height: 297mm;
    display: grid;
    grid-template-columns: repeat(3, 60mm);
    grid-template-rows: repeat(9, 30mm);
    gap: 0;
    padding: 0;
    margin: 0;
  }

  .label-box {
    width: 60mm;
    height: 30mm;
    box-sizing: border-box;
    padding: 1mm 1.5mm;
    display: flex;
    flex-direction: row;
    font-family: "TH Sarabun New", sans-serif;
    border: 0.3px solid #000;
  }

  .qr-side {
    width: 20mm;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    margin-right: 2mm;
  }

  .qr-side img.logo {
    height: 5mm;
    margin-top: 1mm;
    margin-bottom: 2mm;
  }

  .qr-side img.qr {
    width: 18mm;
    height: 18mm;
  }

  .info-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    font-size: 6.5pt;
    line-height: 1.1;
    text-align: left;
    word-break: break-word;

  }


  .company-name {
    font-size: 8pt;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 1mm 0;
    margin-top: 1mm;
    margin-bottom: 2mm;
  }

  .phone {
    font-size: 5pt;
    line-height: 1.1;
  }

  .address {
    font-size: 5pt;
    line-height: 1.1;
    margin-bottom: 0.5mm;
  }

  .product {
    margin-top: 1mm;
    font-size: 6pt;
    line-height: 1.1;
  }
}

.company-name,
.address,
.phone,
.product {
  text-align: left;
}

.page-break {
  page-break-after: always;
}

#qrModal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  background-color: rgba(0, 0, 0, 0.5);
  /* ถ้ามี overlay */
}

#qrModal .modal-content {
  background: white;
  max-width: 800px;
  margin: auto;
  border-radius: 8px;
}

#qrModal {
  display: none;
  /* ซ่อนตั้งแต่ต้น */
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  background-color: rgba(0, 0, 0, 0.5);
}


#qrModal .modal-content {
  max-width: 800px;
  width: 90%;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* ============================================
   NEW CONFIRM MODAL STYLES
   ============================================ */
#confirmOverlay,
.confirm-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 999999;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.confirm-modal-content {
  background: white;
  border-radius: 20px;
  max-width: 400px;
  width: 90%;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }

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

.confirm-modal-header {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  padding: 30px 20px;
  text-align: center;
  color: white;
}

.confirm-modal-icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.confirm-modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.confirm-modal-body {
  padding: 25px 20px;
  text-align: center;
}

.confirm-modal-body p {
  margin: 0;
  font-size: 16px;
  color: #333;
  line-height: 1.5;
}

.confirm-modal-footer {
  padding: 15px 20px 25px;
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirm-btn {
  padding: 12px 28px;
  border: none;
  border-radius: 25px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.confirm-btn-yes {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.confirm-btn-yes:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.confirm-btn-no {
  background: #f1f5f9;
  color: #64748b;
}

.confirm-btn-no:hover {
  background: #e2e8f0;
}

#confirmBox {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  text-align: center;
  max-width: 400px;
}

/* Divider */
.divider {
  text-align: center;
  margin: 20px 0;
  position: relative;
  font-size: 14px;
  color: #aaa;
}

.divider::before,
.divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: #ccc;
}

.divider::before {
  left: 0;
}

.divider::after {
  right: 0;
}

/* Google Button */
.google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 10px 15px;
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.google-btn img {
  width: 20px;
  height: 20px;
  margin-right: 10px;
}

.google-btn:hover {
  background: #f5f5f5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.logo {
  /* จัดวางโลโก้ให้ดูชิดซ้าย‑บนแบบสวย ๆ */
  display: inline-flex;
  flex-direction: column;
  font-family: "Kanit", sans-serif;
  line-height: 1.25;
}

/* ---------------------------
       บรรทัดชื่อแบรนด์
  --------------------------- */
.logo .brand {
  font-size: 2.4rem;
  /* ขนาดหัวโลโก้ */
  font-weight: 700;
  /* หนานิด ๆ */
  letter-spacing: 0.5px;
  /* เพิ่มช่องไฟเล็กน้อย */
  color: #2b2d42;
  /* เทาเข้มนุ่ม ๆ */
  white-space: nowrap;
  /* ไม่ให้ตัดบรรทัด */
}

/* ตัว Q – ทำให้คล้าย QR/ticket */
.logo .brand .q {
  position: relative;
  color: #ff8800;
  /* ส้มแบรนด์ */
  margin: 0 2px;
}

/* สร้าง “กรอบสี่เหลี่ยม” เล็ก ๆ ในตัว Q */
.logo .brand .q::after {
  content: "";
  position: absolute;
  top: 65%;
  left: 52%;
  transform: translate(-50%, -50%);
  width: 0.55em;
  height: 0.55em;
  border: 2px solid currentColor;
  border-radius: 3px;
  /* มุมมนเล็กน้อย */
}

/* ตัว Tag เน้นสีให้แมตช์กับ Q */
.logo .brand .tag {
  color: #ff8800;
}

/* ---------------------------
       บรรทัดคำอธิบาย
  --------------------------- */
.logo .subtitle {
  margin-top: 4px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #5b5b5b;
}

/* ---------------------------
       Responsive tweak
  --------------------------- */
@media (max-width: 480px) {
  .logo .brand {
    font-size: 1.8rem;
  }

  .logo .subtitle {
    font-size: 0.85rem;
  }
}

.slip-image {
  max-width: 100%;
  height: auto;
  cursor: zoom-in;
}

/* tooltip */
.custom-tooltip .tooltip-text {
  visibility: hidden;
  width: 250px;
  background-color: rgba(0, 0, 0, 0.85);
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 8px 12px;
  position: absolute;
  z-index: 1000;
  bottom: 125%;
  /* ขึ้นเหนือปุ่ม */
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  font-size: 14px;
  line-height: 1.4;
}

/* ลูกศรใต้ tooltip */
.custom-tooltip .tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  /* อยู่ด้านล่างของ tooltip */
  left: 50%;
  margin-left: -6px;
  border-width: 6px;
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.85) transparent transparent transparent;
}

/* แสดง tooltip เวลาชี้ */
.custom-tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(-5px);
}

.other-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  /* 2 คอลัมน์ */
  gap: 10px 20px;
  max-height: 300px;
  /* กำหนดความสูงสูงสุด */
  overflow-y: auto;
  /* ถ้าเกินจะ scroll */
  padding: 10px;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #fafafa;
}

.other-list li {
  list-style: none;
  padding: 6px 10px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  font-size: 14px;
}

.podium-container {
  display: flex;
  flex-wrap: wrap;
  /* ให้ตัดบรรทัดเมื่อพื้นที่ไม่พอ */
  justify-content: center;
  /* จัดให้อยู่กลาง */
  align-items: flex-end;
  /* ให้ bottom alignment */
  gap: 20px;
  /* ระยะห่าง */
  margin-top: 20px;
}

.podium-container .card {
  flex: 1;
  min-width: 180px;
  /* ถ้าการ์ดเล็กกว่านี้ให้ตัดบรรทัด */
  max-width: 220px;
  text-align: center;
  padding: 15px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: transform .3s;
}

.podium-container .card:hover {
  transform: translateY(-5px);
}

.podium-container .rank-1 {
  transform: translateY(-20px);
  border: 3px solid;
  border-radius: 12px;
  border-image: linear-gradient(135deg, #4a6ee0, #3b52b2) 1;
  box-shadow: 0 0 12px rgba(74, 110, 224, 0.4);
}

/* 📱 ถ้าหน้าจอแคบ (มือถือ < 600px) → ให้เรียงแนวตั้ง */
@media (max-width: 600px) {
  .card {
    flex: 1 1 calc(50% - 15px);
    /* 2 cards ต่อ 1 แถว, ลบ gap ออก */
  }

  .podium-container {
    flex-direction: column;
    align-items: center;
    /* จัดกลางแนวตั้ง */
  }

  .podium-container .rank-1 {
    transform: none;
    /* ยกเลิกการดันขึ้น */
  }
}

.menu-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  /* จัดกลางแนวนอน */
}

.menu-container>div {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  /* จัดกลางแนวนอน */
}


#otherCustomersList {
  margin: 20px auto 0;
  max-width: 800px;
  /* กำหนดความกว้าง */
}


.pro-card {
  position: relative;
  /* เพื่อให้ tooltip เกาะการ์ดนี้ได้ */
  overflow: visible;
  /* ✅ ห้ามตัด tooltip ทิ้ง */
  cursor: pointer;
  /* ให้รู้ว่าคลิกได้ */
}


.pro-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  font-size: 12px;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.pro-card.disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

#bestSummaryOverlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: none;
  /* ค่าเริ่มต้นซ่อน */
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  font-weight: bold;
}


.disabled-card {
  opacity: 0.5;
  /* จางกว่าปกติ */
  filter: grayscale(50%);
  /* ทำสีเทาๆ */
  cursor: pointer;
  /* ยังเป็นปุ่มกดได้ */
  transition: opacity 0.3s, filter 0.3s;
}

.disabled-card:hover {
  opacity: 0.7;
  /* hover ให้ชัดขึ้นนิดหน่อย */
  filter: grayscale(30%);
}

/* ============================================
   Serial Modal Styles - Modern UI/UX Design
   ============================================ */

/* Modal Base */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  /* ไม่ใช้ animation ที่ backdrop เพื่อให้ blur แสดงทันที */
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Serial Modal Content - Auto height based on content */
.serial-modal-content {
  background: #ffffff !important;
  border-radius: 12px !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
  width: 100% !important;
  max-width: 85vw !important;
  min-width: 800px !important;
  height: auto !important;
  max-height: 98vh !important;
  overflow: hidden !important;
  animation: modalSlideIn 0.3s ease;
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }

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

/* Modal Header - Compact */
.serial-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 15px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px 12px 0 0;
  color: white;
  flex-shrink: 0;
}

.serial-modal-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.serial-icon {
  font-size: 1.2rem;
}

.close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 20px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* Search Section - Inline in pagination row */
.serial-search-section {
  flex: 1;
  max-width: 350px;
  padding: 0;
  background: transparent;
  border: none;
  flex-shrink: 0;
}

.search-wrapper {
  position: relative;
  margin-bottom: 0;
}

.serial-search-input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  border: 1.5px solid #e0e6ff;
  border-radius: 20px;
  font-size: 13px;
  transition: all 0.3s ease;
  background: white;
}

.serial-search-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.serial-search-input::placeholder {
  color: #999;
  font-size: 12px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  pointer-events: none;
  opacity: 0.5;
}

.search-summary {
  padding: 8px 12px;
  background: #e0e6ff;
  border-radius: 8px;
  font-size: 14px;
  color: #4a5568;
  display: inline-block;
  font-weight: 500;
}

/* Table Container - Takes only height needed */
.serial-table-container {
  padding: 10px 20px 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.table-scroll-wrapper {
  max-height: 430px;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  /* Slim scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
}

.serial-table {
  width: 100%;
}

.table-scroll-wrapper::-webkit-scrollbar {
  width: 6px;
}

.table-scroll-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.table-scroll-wrapper::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.table-scroll-wrapper::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

/* Serial Table */
.serial-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
  background: white;
}

.serial-table thead {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.serial-table thead th {
  padding: 16px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.serial-table thead th:first-child {
  border-radius: 12px 0 0 0;
}

.serial-table thead th:last-child {
  border-radius: 0 12px 0 0;
}

.serial-table tbody tr {
  border-bottom: 1px solid #f0f0f0;
  transition: all 0.2s ease;
}

.serial-table tbody tr:hover {
  background: #f8f9ff;
  transform: scale(1.005);
}

.serial-table tbody td {
  padding: 14px;
  font-size: 14px;
  color: #4a5568;
}

.serial-table tbody td:nth-child(2) {
  font-weight: 600;
}

.sn-location {
  white-space: nowrap;
}

.serial-table button {
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  margin: 2px;
}

.serial-table button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.serial-table .btn-danger {
  background: #ef4444;
  color: white;
}

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

/* Pagination row - contains summary and pagination controls */
.serial-pagination-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 15px;
  background: white;
  border-top: 1px solid #e0e6ff;
  flex-shrink: 0;
  gap: 10px;
}

.serial-pagination-row .search-summary {
  font-size: 12px;
  color: #667eea;
  font-weight: 500;
  max-width: 450px;
  overflow-x: auto;
  white-space: nowrap;
  padding: 6px 12px;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8ecff 100%);
  border-radius: 8px;
  border: 1px solid #d4ddff;
  scrollbar-width: thin;
  scrollbar-color: #667eea #e0e6ff;
}

.serial-pagination-row .search-summary::-webkit-scrollbar {
  height: 4px;
}

.serial-pagination-row .search-summary::-webkit-scrollbar-track {
  background: #e0e6ff;
  border-radius: 2px;
}

.serial-pagination-row .search-summary::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 2px;
}

/* Pagination - Always visible below table */
.serial-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.serial-pagination button {
  padding: 6px 12px;
  border: 1px solid #e0e6ff;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
  color: #4a5568;
}

.serial-pagination button:hover {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.serial-pagination input[type="number"] {
  width: 50px;
  padding: 6px;
  border: 1px solid #e0e6ff;
  border-radius: 6px;
  text-align: center;
  font-size: 13px;
}

/* Activation Section - Super compact */
.serial-activation-section {
  padding: 6px 15px 8px;
  background: #f8f9ff;
  border-top: 1px solid #e0e6ff;
  border-radius: 0 0 12px 12px;
  flex-shrink: 0;
}

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

.activation-header h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #2d3748;
  display: flex;
  align-items: center;
  gap: 5px;
}

.activation-icon {
  font-size: 1rem;
}

.serial-count-badge {
  padding: 6px 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

/* Activation Grid - Compact layout */
.activation-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.activation-field {
  display: flex;
  flex-direction: column;
}

.activation-field label {
  margin-bottom: 5px;
  font-weight: 600;
  font-size: 12px;
  color: #4a5568;
  display: flex;
  align-items: center;
  gap: 4px;
}

.field-icon {
  font-size: 14px;
}

.activation-input,
.customer-input {
  padding: 8px 10px;
  border: 1px solid #e0e6ff;
  border-radius: 8px;
  font-size: 13px;
  transition: all 0.3s ease;
  background: white;
}

.activation-input:focus,
.customer-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.activation-input:disabled {
  background: #e2e8f0;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Customer Input Wrapper */
.customer-input-wrapper {
  position: relative;
  overflow: visible;
}

.clear-input-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 20px;
  color: #ef4444;
  font-weight: bold;
  display: none;
  transition: all 0.2s ease;
}

.clear-input-btn:hover {
  transform: translateY(-50%) scale(1.2);
}

.customer-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  width: 100%;
  max-height: 84px;
  overflow-y: auto;
  background: white;
  border: 2px solid #667eea;
  border-radius: 0 0 12px 12px;
  display: none;
  z-index: 99999;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.customer-dropdown div {
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.customer-dropdown div:hover {
  background: #f8f9ff;
}

/* Range Input Group */
.range-input-group {
  display: flex;
  gap: 8px;
}

.range-input-group input {
  flex: 1;
}

.btn-download-range {
  padding: 12px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-download-range:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.3);
}

/* Activation Buttons - Compact */
.activation-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
  margin-bottom: 15px;
  padding-bottom: 10px;
}

.btn-activate,
.btn-close {
  padding: 10px 24px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-activate {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-activate:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.btn-close {
  background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(148, 163, 184, 0.3);
}

.btn-close:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(148, 163, 184, 0.4);
}

.serial-summary {
  margin-top: 15px;
  padding: 15px;
  background: #e8f5e9;
  border-left: 4px solid #4caf50;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
  display: none;
  /* ✨ ซ่อนไว้ก่อน แสดงเฉพาะตอนเปิดใช้งานซีเรียลเสร็จ */
}

/* Responsive Design */
@media (max-width: 768px) {
  .serial-modal-content {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
    overflow-y: auto;
  }

  .serial-modal-header {
    padding: 15px;
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 10;
  }

  .serial-modal-header h2 {
    font-size: 1.1rem;
  }

  .table-scroll-wrapper {
    max-height: none;
    overflow-y: visible;
  }

  .serial-search-section,
  .serial-table-container,
  .serial-activation-section {
    padding: 15px 20px;
  }

  .activation-grid {
    grid-template-columns: 1fr;
  }

  .serial-table {
    font-size: 13px;
    border-collapse: collapse;
  }

  /* Card layout for serial-table on mobile */
  .serial-table thead {
    display: none;
  }

  .serial-table tbody tr {
    display: block;
    margin-bottom: 15px;
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
  }

  .serial-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    text-align: right;
  }

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

  .serial-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #667eea;
    font-size: 12px;
    text-align: left;
  }

  .btn-activate,
  .btn-close {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .serial-modal-header h2 {
    font-size: 1.1rem;
  }

  .serial-icon,
  .activation-icon {
    font-size: 1.2rem;
  }

  .close-btn {
    width: 35px;
    height: 35px;
    font-size: 24px;
  }
}

/* ============================================
   Files Management Page - Modern Card Layout
   ============================================ */

/* Page Header */
#files h2 {
  color: #2d3748;
  margin-bottom: 25px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Header Actions - Scan Button */
.files-header-actions {
  margin-bottom: 25px;
}

.scan-activate-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
  transition: all 0.3s ease;
  position: relative;
}

.scan-activate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

.scan-activate-btn .btn-icon {
  font-size: 20px;
}

.scan-activate-btn .btn-text {
  font-weight: 600;
}

/* Search Container */
.files-search-container {
  margin-bottom: 20px;
}

.files-search-wrapper {
  position: relative;
}

.files-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  opacity: 0.5;
  pointer-events: none;
}

.files-search-input {
  width: 100%;
  padding: 14px 20px 14px 50px;
  border: 2px solid #e0e6ff;
  border-radius: 12px;
  font-size: 15px;
  transition: all 0.3s ease;
  background: white;
  font-family: 'Kanit', sans-serif;
}

.files-search-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.files-search-input::placeholder {
  color: #a0aec0;
}

/* Controls Row - Filter and Sort */
.files-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  gap: 20px;
  flex-wrap: wrap;
}

/* Filter Buttons */
.files-filter-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.files-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 2px solid #e0e6ff;
  background: white;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Kanit', sans-serif;
}

.files-filter-btn:hover {
  border-color: #667eea;
  background: #f8f9ff;
  transform: translateY(-2px);
}

.files-filter-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: #667eea;
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.files-filter-btn .filter-icon {
  font-size: 18px;
}

/* Sort Control */
.files-sort-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.files-sort-control label {
  font-weight: 600;
  font-size: 14px;
  color: #4a5568;
}

.files-sort-select {
  padding: 10px 16px;
  border: 2px solid #e0e6ff;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #4a5568;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Kanit', sans-serif;
}

.files-sort-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* Files Grid - Compact List View */
.files-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 30px;
}

/* File Card - Horizontal List Item */
.file-card {
  background: white;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
}

.file-card:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: #e0e6ff;
  background: #f8f9ff;
}

/* File Icon Container */
.file-card-icon {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: white;
  position: relative;
  overflow: hidden;
}

.file-card-icon.product {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.file-card-icon.pdf {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.file-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

/* File Content - Main Info */
.file-card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #2d3748;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  line-height: 1.3;
}

.file-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #718096;
}

.file-card-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.file-card-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.file-card-badge.product {
  background: #d1fae5;
  color: #059669;
}

.file-card-badge.pdf {
  background: #e0e6ff;
  color: #667eea;
}

.file-card-badge.category {
  background: #fef3c7;
  color: #d97706;
}

/* File Actions - Right Side */
.file-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.file-card-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: 'Kanit', sans-serif;
}

.file-card-btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.2);
}

.file-card-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.file-card-btn-secondary {
  background: #f8f9ff;
  color: #667eea;
  border: 2px solid #e0e6ff;
}

.file-card-btn-secondary:hover {
  background: white;
  border-color: #667eea;
}

.file-card-btn-warning {
  background: #fef3c7;
  color: #d97706;
  border: 2px solid #fde68a;
}

.file-card-btn-warning:hover {
  background: #fbbf24;
  color: white;
  border-color: #fbbf24;
}

.file-card-btn-info {
  background: #dbeafe;
  color: #2563eb;
  border: 2px solid #bfdbfe;
}

.file-card-btn-info:hover {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.file-card-btn-danger {
  background: #fee2e2;
  color: #dc2626;
  border: 2px solid #fecaca;
}

.file-card-btn-danger:hover {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

/* Product Serial Info - Inline */
.file-card-serial-info {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 4px 10px;
  background: #f8f9ff;
  border-radius: 8px;
  border-left: 3px solid #667eea;
}

.file-card-serial-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #667eea;
  font-weight: 600;
}

.file-card-serial-number {
  font-size: 14px;
  font-weight: 700;
  color: #667eea;
}

.file-card-serial-label {
  font-size: 11px;
  color: #718096;
}

/* Load More Button */
.files-load-more {
  text-align: center;
  margin: 30px 0;
}

.files-load-more-btn {
  padding: 14px 32px;
  background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(148, 163, 184, 0.25);
  font-family: 'Kanit', sans-serif;
}

.files-load-more-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(148, 163, 184, 0.35);
}

.files-load-more-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Empty State */
.files-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #718096;
}

.files-empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.files-empty-title {
  font-size: 20px;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 8px;
}

.files-empty-text {
  font-size: 15px;
  color: #718096;
}

/* Loading State */
.files-loading {
  text-align: center;
  padding: 60px 20px;
  color: #718096;
}

.files-loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f4f6;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Responsive Design */
@media (max-width: 1024px) {
  .file-card {
    padding: 14px 16px;
  }

  .file-card-icon {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }

  .file-card-actions {
    gap: 6px;
  }

  .file-card-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
}

@media (max-width: 768px) {
  .files-controls-row {
    flex-direction: column;
    align-items: stretch;
  }

  .files-filter-buttons {
    justify-content: center;
  }

  .files-sort-control {
    justify-content: space-between;
  }

  .file-card {
    flex-wrap: wrap;
    gap: 12px;
  }

  .file-card-icon {
    width: 48px;
    height: 48px;
  }

  .file-card-content {
    flex-basis: calc(100% - 64px);
  }

  .file-card-actions {
    width: 100%;
    justify-content: flex-start;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
  }

  .file-card-btn {
    flex: 1;
    min-width: auto;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .scan-activate-btn {
    width: 100%;
    justify-content: center;
  }

  .files-filter-btn {
    flex: 1;
    justify-content: center;
    padding: 8px 12px;
  }

  .file-card {
    padding: 12px;
  }

  .file-card-title {
    font-size: 15px;
  }

  .file-card-meta {
    font-size: 12px;
  }

  .file-card-actions {
    flex-direction: column;
    gap: 6px;
  }

  .file-card-btn {
    width: 100%;
  }
}

/* ============================================
   Statistics Page Styling
   ============================================ */

#statistics h2 {
  color: #2d3748;
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Summary Cards */
.stats-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, min max(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stats-card {
  background: white;
  border-radius: 16px;
  padding: 25px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.stats-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea, #764ba2);
}

.stats-card.total::before {
  background: linear-gradient(90deg, #667eea, #764ba2);
}

.stats-card.products::before {
  background: linear-gradient(90deg, #10b981, #059669);
}

.stats-card.pdfs::before {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.stats-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.stats-card-icon {
  font-size: 48px;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #f8f9ff, #e0e6ff);
}

.stats-card-content {
  flex: 1;
}

.stats-card-value {
  font-size: 36px;
  font-weight: 700;
  color: #2d3748;
  line-height: 1;
  margin-bottom: 8px;
}

.stats-card-label {
  font-size: 16px;
  color: #718096;
  font-weight: 600;
}

.stats-card-subtitle {
  font-size: 14px;
  color: #a0aec0;
  margin-top: 4px;
}

/* Filter Row */
.stats-filter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 15px;
}

.stats-filter-row h3 {
  color: #2d3748;
  margin: 0;
  font-size: 20px;
}

.stats-filter-buttons {
  display: flex;
  gap: 10px;
}

.stats-filter-btn {
  padding: 10px 24px;
  border: 2px solid #e0e6ff;
  background: white;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Kanit', sans-serif;
}

.stats-filter-btn:hover {
  border-color: #667eea;
  background: #f8f9ff;
}

.stats-filter-btn.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-color: #667eea;
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Top Items List */
.stats-top-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 8px;
}

.stats-item {
  background: white;
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.stats-item:hover {
  transform: translateX(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  border-color: #e0e6ff;
}

/* Rank Badge */
.stats-item-rank {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

.stats-item-rank.rank-1 {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: white;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
}

.stats-item-rank.rank-2 {
  background: linear-gradient(135deg, #9ca3af, #6b7280);
  color: white;
  box-shadow: 0 4px 12px rgba(156, 163, 175, 0.4);
}

.stats-item-rank.rank-3 {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.stats-item-rank.rank-other {
  background: #f3f4f6;
  color: #6b7280;
  font-size: 18px;
}

/* Item Thumbnail */
.stats-item-thumbnail {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  flex-shrink: 0;
  overflow: hidden;
  background: linear-gradient(135deg, #f8f9ff, #e0e6ff);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stats-item-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stats-item-thumbnail-icon {
  font-size: 32px;
}

/* Item Content */
.stats-item-content {
  flex: 1;
  min-width: 0;
}

.stats-item-name {
  font-size: 16px;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats-item-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #718096;
}

.stats-item-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.stats-item-badge.product {
  background: #d1fae5;
  color: #059669;
}

.stats-item-badge.pdf {
  background: #fee2e2;
  color: #dc2626;
}

.stats-item-badge.customer {
  background: #dbeafe;
  color: #2563eb;
}

/* Item Views */
.stats-item-views {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: #667eea;
  white-space: nowrap;
}

.stats-item-views-icon {
  font-size: 20px;
}

/* Empty State */
.stats-empty {
  text-align: center;
  padding: 60px 20px;
  color: #718096;
}

.stats-empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.stats-empty-text {
  font-size: 16px;
  color: #4a5568;
}

/* Loading State */
.stats-loading {
  text-align: center;
  padding: 60px 20px;
}

.stats-loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f4f6;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

/* Responsive */
@media (max-width: 768px) {
  .stats-summary-cards {
    grid-template-columns: 1fr;
  }

  .stats-filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .stats-filter-row h3 {
    text-align: center;
  }

  .stats-filter-buttons {
    justify-content: center;
  }

  .stats-item {
    flex-wrap: wrap;
  }

  .stats-item-content {
    flex-basis: 100%;
    order: 3;
  }

  .stats-item-views {
    margin-left: auto;
  }
}

@media (max-width: 480px) {
  .stats-card {
    flex-direction: column;
    text-align: center;
  }

  .stats-card-icon {
    width: 70px;
    height: 70px;
    font-size: 40px;
  }

  .stats-card-value {
    font-size: 32px;
  }

  .stats-item-rank {
    width: 45px;
    height: 45px;
    font-size: 18px;
  }

  .stats-item-thumbnail {
    width: 50px;
    height: 50px;
  }

  .stats-filter-btn {
    flex: 1;
    padding: 10px 16px;
  }
}

/* ============================================
   Customer Serial Summary Page - Modern Design
   ============================================ */

/* Main container - clean and minimal */
.sn-summary-container {
  background: white;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  margin: 20px 0;
  overflow: visible;
  /* ✨ ให้ dropdown แสดงครบไม่ถูกตัด */
}

/* Header - compact and clean */
.sn-summary-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px 32px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px 16px 0 0;
  /* ✨ เพิ่มเพื่อให้มุมโค้งสวย */
}

.sn-summary-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-icon {
  font-size: 1.6rem;
}

/* Search Controls Section - clean white background */
.sn-summary-controls {
  padding: 24px 32px;
  background: #fafbfc;
  border-bottom: 1px solid #e2e8f0;
}

.sn-summary-controls form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 20px;
  align-items: end;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-group.control-buttons {
  display: flex;
  flex-direction: row;
  gap: 12px;
}

.control-label {
  font-weight: 600;
  font-size: 14px;
  color: #4a5568;
  display: flex;
  align-items: center;
  gap: 8px;
}

.label-icon {
  font-size: 18px;
}

/* Modern Input Styling */
.modern-input {
  padding: 14px 18px;
  border: 2px solid #e0e6ff;
  border-radius: 12px;
  font-size: 15px;
  transition: all 0.3s ease;
  background: white;
  font-family: 'Kanit', sans-serif;
  width: 100%;
  box-sizing: border-box;
}

.modern-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.modern-input::placeholder {
  color: #a0aec0;
}

.input-wrapper {
  position: relative;
}

.clear-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 20px;
  color: #ef4444;
  font-weight: bold;
  display: none;
  transition: all 0.2s ease;
  z-index: 10;
}

.clear-btn:hover {
  transform: translateY(-50%) scale(1.2);
}

/* Modern Dropdown */
.modern-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-height: 200px;
  overflow-y: auto;
  background: white;
  border: 2px solid #e0e6ff;
  border-top: none;
  border-radius: 0 0 12px 12px;
  display: none;
  z-index: 10001;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modern-dropdown div {
  padding: 12px 18px;
  cursor: pointer;
  transition: background 0.2s ease;
  font-size: 14px;
}

.modern-dropdown div:hover {
  background: #f8f9ff;
}

/* Modern Buttons */
.btn-modern {
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  font-family: 'Kanit', sans-serif;
}

.btn-modern.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-modern.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

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

.btn-modern.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-modern.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

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

.btn-icon {
  font-size: 18px;
}

/* Results Container - clean and minimal */
.sn-summary-results {
  padding: 24px 32px;
  background: white;
  min-height: 100px;
  border-radius: 0 0 16px 16px;
  /* ✨ ขอบล่างมนเหมือนด้านบน */
}

/* Empty state message */
.sn-summary-results:empty::before {
  content: "กรุณาระบุชื่อลูกค้าเพื่อค้นหาข้อมูล";
  display: block;
  text-align: center;
  padding: 40px 20px;
  color: #a0aec0;
  font-size: 14px;
}

/* Override table styles generated by JavaScript */
.sn-summary-results table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  margin-top: 16px;
}

.sn-summary-results table thead {
  background: #f7fafc !important;
  /* พื้นเทาอ่อน */
  color: #2d3748 !important;
  /* ตัวหนังสือดำ */
  border-bottom: 2px solid #e2e8f0;
}

.sn-summary-results table thead th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #2d3748 !important;
  /* ตัวหนังสือดำ */
  background: transparent !important;
}

.sn-summary-results table tbody tr {
  border-bottom: 1px solid #e2e8f0;
  transition: all 0.15s ease;
}

.sn-summary-results table tbody tr:hover {
  background: #f7fafc;
}

.sn-summary-results table tbody td {
  padding: 12px 16px;
  font-size: 14px;
  color: #2d3748;
}

/* Results counter badge - clean and minimal */
.sn-summary-results h3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #667eea;
  color: white;
  border-radius: 20px;
  font-size: 14px;
  margin-bottom: 16px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

/* Responsive Design */
@media (max-width: 968px) {
  .sn-summary-controls form {
    grid-template-columns: 1fr 1fr;
  }

  .control-group.control-buttons {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .sn-summary-header {
    padding: 24px 20px;
  }

  .sn-summary-header h2 {
    font-size: 1.5rem;
  }

  .header-icon {
    font-size: 1.8rem;
  }

  .sn-summary-controls {
    padding: 24px 20px;
  }

  .sn-summary-controls form {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .control-group.control-buttons {
    flex-direction: column;
  }

  .sn-summary-results {
    padding: 24px 20px;
  }

  .btn-modern {
    width: 100%;
    justify-content: center;
  }

  .sn-summary-results table {
    font-size: 13px;
  }

  .sn-summary-results table thead th,
  .sn-summary-results table tbody td {
    padding: 10px 8px;
  }
}

@media (max-width: 480px) {
  .sn-summary-header h2 {
    font-size: 1.3rem;
    flex-direction: column;
    gap: 8px;
  }

  .sn-summary-results h3 {
    font-size: 14px;
    padding: 10px 20px;
  }
}

/* ============================================
   Activation Summary Page - Modern Design
   ============================================ */

/* Main container */
.activation-summary-container {
  background: white;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  margin: 20px 0;
  overflow: visible;
}

/* Header */
.activation-summary-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px 32px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px 16px 0 0;
}

.activation-summary-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Filters Section */
.activation-filters {
  padding: 24px 32px;
  background: #fafbfc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.date-range-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-label {
  font-weight: 600;
  font-size: 14px;
  color: #4a5568;
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-inputs {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modern-date-input {
  padding: 12px 16px;
  border: 2px solid #e0e6ff;
  border-radius: 12px;
  font-size: 14px;
  font-family: 'Kanit', sans-serif;
  transition: all 0.3s ease;
  background: white;
  min-width: 160px;
}

.modern-date-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.date-separator {
  font-size: 18px;
  color: #a0aec0;
  font-weight: 500;
}

/* Filter Actions */
.filter-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.quick-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-quick {
  padding: 10px 20px;
  border: 2px solid #e2e8f0;
  background: white;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Kanit', sans-serif;
}

.btn-quick:hover {
  border-color: #667eea;
  background: #f8f9ff;
  color: #667eea;
  transform: translateY(-1px);
}

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

/* Summary Stats */
.activation-stats {
  padding: 20px 32px;
  background: white;
  border-bottom: 1px solid #e2e8f0;
}

.activation-stats:empty {
  display: none;
}

/* Products Grid */
.activation-products-grid {
  padding: 24px 32px;
  background: white;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  border-radius: 0 0 16px 16px;
}

/* Responsive Design */
@media (max-width: 968px) {
  .activation-filters {
    padding: 20px;
  }

  .date-inputs {
    flex-direction: column;
    align-items: stretch;
  }

  .date-separator {
    display: none;
  }

  .filter-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-modern {
    width: 100%;
    justify-content: center;
  }

  .activation-products-grid {
    grid-template-columns: 1fr;
    padding: 20px;
  }
}

@media (max-width: 768px) {
  .activation-summary-header {
    padding: 20px;
  }

  .activation-summary-header h2 {
    font-size: 1.3rem;
  }

  .quick-filters {
    width: 100%;
  }

  .btn-quick {
    flex: 1;
  }
}

/* ============================================
   Control Panel Sidebar Navigation
   ============================================ */

.control-panel-sidebar {
  position: fixed;
  left: 0;
  top: 80px;
  width: 60px;
  height: calc(100vh - 80px);
  background: white;
  border-right: 2px solid #e0e6ff;
  border-radius: 0 16px 16px 0;
  padding: 20px 0;
  z-index: 100;
  visibility: hidden;
  overflow: hidden;
  /* ซ่อน text ที่เกิน */
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0s 0.4s;
}

.control-panel-sidebar.active {
  visibility: visible;
  transform: translateX(0);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0s 0s;
}

/* Hover เพื่อขยาย */
.control-panel-sidebar:hover {
  width: 240px;
}

.sidebar-content {
  padding: 0;
  /* ลบ padding เพื่อให้ icon อยู่กลาง */
  width: 240px;
}

.sidebar-title {
  font-size: 18px;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 20px;
  padding: 0 10px;
  white-space: nowrap;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0px;
  /* เว้นขอบเล็กน้อย */
}

.sidebar-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 8px;
  /* เพิ่ม padding-left ให้ icon อยู่กลาง */
  margin: 0 8px;
  /* เว้นขอบไม่ให้เกินตอน hover */
  border-radius: 10px;
  text-decoration: none;
  color: #4a5568;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  white-space: nowrap;
}

.sidebar-menu-item:hover {
  background: #f8f9ff;
  color: #667eea;
}

/* Active state - สีม่วงเบาๆ */
.sidebar-menu-item.active {
  background: transparent;
  color: #667eea;
}

/* Active indicator - จุดทางซ้าย */
.sidebar-menu-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 0 2px 2px 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Active state เต็มที่เมื่อ hover sidebar */
.control-panel-sidebar:hover .sidebar-menu-item.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* ซ่อน indicator เดิมเมื่อ hover */
.control-panel-sidebar:hover .sidebar-menu-item.active::before {
  opacity: 0;
}

.sidebar-icon {
  font-size: 20px;
  flex-shrink: 0;
  min-width: 20px;
}

.sidebar-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pro-badge-small {
  background: #fbbf24;
  color: white;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 8px;
  font-weight: 700;
  white-space: nowrap;
}

/* Toggle Button for Mobile */
.sidebar-toggle {
  display: none;
  position: fixed;
  left: 10px;
  top: 100px;
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 12px;
  justify-content: center;
  align-items: center;
  color: white;
  font-size: 24px;
  cursor: pointer;
  z-index: 101;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* ลบ margin adjustment - ให้ content เต็มพื้นที่ */
.main-content.with-sidebar {
  margin-left: 0;
}

/* Responsive Design */
@media (max-width: 1024px) {

  /* ซ่อน sidebar และ toggle button ทั้งหมดบน mobile */
  .control-panel-sidebar {
    display: none !important;
  }

  .sidebar-toggle {
    display: none !important;
  }

  .main-content.with-sidebar {
    margin-left: 0;
  }
}