* {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  padding: 0;
  background: #f4f4f4;
  color: #222;
  font-size: 16px; /* ป้องกัน zoom ใน iOS */
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden; /* ป้องกันการเลื่อนซ้ายขวา */
  /* Safe area สำหรับ iPhone X+ */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

header, footer {
  text-align: center;
  padding: 12px 16px;
  background: #333;
  color: #fff;
  position: relative;
}

header h1 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.3;
}
header p {
  margin: 4px 0 0;
  font-size: 0.85rem;
}

/* Tablet Header Adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  header {
    padding: 16px 24px;
  }
  
  header h1 {
    font-size: 1.4rem;
    line-height: 1.2;
  }
  
  .user-info {
    position: absolute;
    top: 16px;
    right: 24px;
    font-size: 0.9rem;
  }
  
  .logout-btn {
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 6px;
    font-weight: 600;
  }
}

/* Mobile Header Adjustments */
@media (max-width: 768px) {
  header {
    padding: 8px 12px;
  }
  
  header h1 {
    font-size: 1rem;
    word-break: break-word;
  }
}

.nav-menu {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 16px;
}

.nav-menu a {
  color: #fff;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 4px;
  background: rgba(255,255,255,0.1);
  transition: background 0.2s;
}

.nav-menu a:hover {
  background: rgba(255,255,255,0.2);
}

.nav-menu a.nav-active {
  background: #007bff;
}

.user-info {
  position: absolute;
  top: 12px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

/* Mobile User Info */
@media (max-width: 768px) {
  .user-info {
    position: static;
    justify-content: center;
    margin-top: 8px;
    font-size: 0.75rem;
  }
  
  .user-info span {
    display: block;
    margin-bottom: 4px;
  }
}

/* Tab Styles */
.tab-menu {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
}

.tab-btn {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  font-size: 0.9rem;
  transition: background 0.2s;
  min-height: 44px; /* Touch target size */
}

.tab-btn:hover {
  background: rgba(255,255,255,0.2);
}

.tab-btn.active {
  background: #fff;
  color: #333;
}

/* Tablet Tab Styles */
@media (min-width: 769px) and (max-width: 1024px) {
  .tab-menu {
    gap: 8px;
    margin-top: 16px;
  }
  
  .tab-btn {
    padding: 16px 32px;
    font-size: 1.1rem;
    min-height: 56px;
    border-radius: 12px 12px 0 0;
    font-weight: 600;
    transition: all 0.3s ease;
  }
  
  .tab-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
  }
  
  .tab-btn.active {
    background: #fff;
    color: #333;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
  }
}

/* Mobile Tab Styles */
@media (max-width: 768px) {
  .tab-menu {
    gap: 2px;
  }
  
  .tab-btn {
    flex: 1;
    padding: 12px 8px;
    font-size: 0.8rem;
    min-height: 48px;
  }
}

.tab-content {
  display: none;
}

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

/* Login Styles */
.login-container {
  max-width: 600px;
  margin: 0 auto;
}

.system-select {
  text-align: center;
}

.system-buttons {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.system-btn {
  background: #fff;
  border: 2px solid #ddd;
  border-radius: 12px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s;
  min-width: 200px;
  text-align: center;
  min-height: 44px;
}

.system-btn:hover {
  border-color: #007bff;
  box-shadow: 0 4px 12px rgba(0,123,255,0.15);
}

/* Mobile Login Styles */
@media (max-width: 768px) {
  .system-buttons {
    flex-direction: column;
    gap: 16px;
    padding: 0 16px;
  }
  
  .system-btn {
    min-width: 100%;
    padding: 20px 16px;
    min-height: 80px;
  }
  
  .system-icon {
    font-size: 2.5rem !important;
  }
  
  .login-form {
    padding: 0 16px;
  }
  
  .form-buttons {
    flex-direction: column;
    gap: 12px;
  }
  
  .form-buttons button {
    width: 100%;
  }
}

.system-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.system-btn h3 {
  margin: 8px 0;
  color: #333;
}

.system-btn p {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
}

.login-form {
  max-width: 400px;
  margin: 0 auto;
}

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

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: bold;
}

.form-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* Admin Styles */
.logout-btn {
  background: #dc3545;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  margin-left: auto;
}

.admin-form {
  background: #f8f9fa;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.admin-form h3 {
  margin-top: 0;
  margin-bottom: 12px;
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

.form-row input,
.form-row select {
  flex: 1;
  min-width: 150px;
}

.admin-table {
  margin-top: 20px;
}

.admin-table h3 {
  margin-bottom: 12px;
}

.filter-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-row select {
  min-width: 150px;
}

/* Dropdown Sections */
.dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 12px 0;
  border-bottom: 1px solid #ddd;
  user-select: none;
}

.dropdown-header:hover {
  background: rgba(0,123,255,0.05);
  margin: 0 -16px;
  padding: 12px 16px;
  border-radius: 4px;
}

.dropdown-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.dropdown-arrow {
  font-size: 0.8rem;
  transition: transform 0.3s;
}

.dropdown-arrow.rotated {
  transform: rotate(180deg);
}

.dropdown-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.dropdown-content.open {
  max-height: 2000px;
  padding-top: 16px;
}

/* Products Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.product-item {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  background: #f9f9f9;
}

.product-item h4 {
  margin: 0 0 8px 0;
  color: #333;
}

.product-item .product-info {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 8px;
}

.product-item .product-actions {
  display: flex;
  gap: 8px;
}

.product-item button {
  flex: 1;
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* Product Categories in Invoice */
.product-category-section {
  margin-bottom: 20px;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
}

.category-header {
  background: #f8f9fa;
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #ddd;
  user-select: none;
  min-height: 44px;
}

.category-header:hover {
  background: #e9ecef;
}

.category-header h4 {
  margin: 0;
  font-size: 1rem;
  color: #333;
}

.category-arrow {
  font-size: 0.8rem;
  transition: transform 0.3s;
}

.category-arrow.rotated {
  transform: rotate(180deg);
}

.category-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.category-content.open {
  max-height: 1000px;
  padding: 16px;
}

/* Mobile Category Styles */
@media (max-width: 768px) {
  .product-category-section {
    margin-bottom: 16px;
  }
  
  .category-header {
    padding: 16px 12px;
    min-height: 48px;
  }
  
  .category-header h4 {
    font-size: 0.9rem;
    line-height: 1.3;
  }
  
  .category-content.open {
    padding: 12px 8px;
  }
}

.products-table-container {
  overflow-x: visible;
  border-radius: 8px;
  border: 1px solid #ddd;
  position: relative;
  background: white;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.products-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 100%;
}

.products-table th,
.products-table td {
  border: 1px solid #ddd;
  padding: 8px 6px;
  text-align: center;
  font-size: 0.9rem;
  vertical-align: middle;
  word-wrap: break-word;
}

.products-table th {
  background: #f8f9fa;
  font-weight: bold;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 2px solid #007bff;
  padding: 10px 6px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.products-table input {
  width: 100%;
  padding: 6px 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
  text-align: center;
  font-size: 14px;
  box-sizing: border-box;
  min-height: 32px;
}

.product-name-cell {
  text-align: left !important;
  font-weight: bold;
  vertical-align: middle;
  background: #f9f9f9;
  width: 35%;
  padding: 10px 8px;
  font-size: 0.9rem;
  line-height: 1.3;
  color: #333;
}

/* Column widths - ปรับให้สมส่วนกว่า */
.col-product-name { width: 35%; }
.col-data1 { width: 21.67%; }
.col-data2 { width: 21.67%; }
.col-data3 { width: 21.67%; }

/* Two-row product layout */
.product-row-sell {
  border-bottom: 1px solid #e9ecef;
}

.product-row-sell td {
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  padding: 8px 6px;
}

.product-row-exchange {
  border-top: none;
}

.product-row-exchange td {
  background: #f8f9fa;
  font-size: 0.85rem;
  border-top: 1px dashed #007bff;
  padding: 8px 6px;
}

/* Header styling */
.header-row-1 th {
  background: #007bff;
  color: white;
  font-weight: bold;
  font-size: 0.9rem;
  padding: 12px 8px;
}

.header-row-2 th {
  background: #0056b3;
  color: white;
  font-weight: bold;
  font-size: 0.85rem;
  padding: 10px 8px;
}

/* Prevent table layout shifts and ensure proper containment */
.products-table-container {
  contain: layout style;
  overflow: hidden;
  margin: 0 auto;
}

.products-table {
  border-spacing: 0;
  max-width: 100%;
  table-layout: fixed;
}

/* Ensure table fits within container */
.products-section {
  width: 100%;
  overflow: hidden;
}

.products-table input:focus {
  outline: 2px solid #007bff;
  outline-offset: -1px;
}

/* Ensure consistent input sizing */
.products-table input[type="number"] {
  -moz-appearance: textfield;
}

.products-table input[type="number"]::-webkit-outer-spin-button,
.products-table input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Hide mobile container by default */
.mobile-products-container {
  display: none;
}

/* Mobile Products Table - Card Layout */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }
  
  main {
    padding: 0 4px;
    margin: 4px auto;
    max-width: 100vw;
    box-sizing: border-box;
  }
  
  .card {
    padding: 8px;
    margin-bottom: 8px;
    overflow-x: hidden;
  }
  
  .products-section {
    margin: 0;
    padding: 0;
    width: 100%;
  }
  
  /* Hide the traditional table on mobile */
  .products-table-container {
    display: none;
  }
  
  /* Show mobile card layout */
  .mobile-products-container {
    display: block;
    width: 100%;
  }
  
  .mobile-product-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 8px;
    padding: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  }
  
  .mobile-product-header {
    font-weight: bold;
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #007bff;
    text-align: center;
  }
  
  .mobile-product-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
  }
  
  .mobile-input-group {
    display: flex;
    flex-direction: column;
  }
  
  .mobile-input-label {
    font-size: 0.7rem;
    color: #666;
    margin-bottom: 2px;
    font-weight: 500;
  }
  
  .mobile-input {
    width: 100%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    min-height: 36px;
    text-align: center;
    box-sizing: border-box;
  }
  
  .mobile-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 6px;
    border: 1px solid #007bff;
    font-weight: bold;
    font-size: 0.85rem;
    margin-top: 8px;
  }
  
  .mobile-total-label {
    color: #333;
  }
  
  .mobile-total-amount {
    color: #007bff;
    font-size: 1rem;
    font-weight: bold;
  }
  
  .mobile-total-currency {
    color: #333;
    font-size: 0.8rem;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  .products-table th,
  .products-table td {
    padding: 0.5px;
    font-size: 0.5rem;
  }
  
  .products-table input {
    padding: 0.5px;
    font-size: 8px;
    min-height: 20px;
  }
  
  .product-name-cell {
    font-size: 0.45rem !important;
    padding: 0.5px !important;
  }
  
  .header-row-1 th,
  .header-row-2 th {
    font-size: 0.45rem;
    padding: 0.5px;
  }
}

/* Very small screens */
@media (max-width: 360px) {
  .products-table th,
  .products-table td {
    padding: 1px;
    font-size: 0.55rem;
  }
  
  .products-table input {
    padding: 1px;
    font-size: 9px;
    min-height: 24px;
  }
  
  .product-name-cell {
    font-size: 0.5rem;
    padding: 1px !important;
  }
  
  .header-row-1 th,
  .header-row-2 th {
    font-size: 0.5rem;
    padding: 1px;
  }
}

/* Mobile Portrait Orientation */
@media (max-width: 768px) and (orientation: portrait) {
  .products-table-container {
    margin: 0;
    border-radius: 4px;
    width: 100%;
    max-width: 100vw;
    overflow: visible;
  }
  
  .products-table {
    width: 100%;
    font-size: 0.6rem;
    table-layout: fixed;
    border-collapse: collapse;
  }
  
  .products-table th,
  .products-table td {
    padding: 1px;
    font-size: 0.6rem;
    border: 1px solid #ddd;
    text-align: center;
  }
  
  .products-table input {
    width: 100%;
    padding: 1px;
    font-size: 10px;
    min-height: 26px;
    border: 1px solid #ccc;
    border-radius: 2px;
    text-align: center;
    box-sizing: border-box;
  }
  
  /* Portrait specific column widths */
  .col-product-name { 
    width: 35% !important;
  }
  
  .col-data1, .col-data2, .col-data3 { 
    width: 21.67% !important;
  }
  
  .product-name-cell {
    font-size: 0.55rem !important;
    width: 35% !important;
    padding: 2px 1px !important;
    text-align: left !important;
    word-break: break-word;
    line-height: 1.0;
  }
  
  /* Header styling for portrait */
  .header-row-1 th {
    background: #007bff !important;
    color: white !important;
    font-size: 0.55rem;
    padding: 2px 1px;
    font-weight: bold;
  }
  
  .header-row-2 th {
    background: #0056b3 !important;
    color: white !important;
    font-size: 0.5rem;
    padding: 2px 1px;
    font-weight: bold;
  }
  
  /* Row styling for portrait */
  .product-row-sell td {
    background: #fff;
    padding: 1px;
  }
  
  .product-row-exchange td {
    background: #f8f9fa;
    border-top: 1px dashed #007bff;
    padding: 1px;
    font-size: 0.55rem;
  }
}

/* Small Portrait Phones */
@media (max-width: 480px) and (orientation: portrait) {
  .products-table {
    font-size: 0.55rem;
  }
  
  .products-table th,
  .products-table td {
    padding: 1px;
    font-size: 0.55rem;
  }
  
  .products-table input {
    font-size: 9px;
    min-height: 24px;
    padding: 1px;
  }
  
  .product-name-cell {
    font-size: 0.5rem !important;
    padding: 1px !important;
  }
  
  .header-row-1 th,
  .header-row-2 th {
    font-size: 0.5rem;
    padding: 1px;
  }
}

/* Extra Small Portrait Phones */
@media (max-width: 360px) and (orientation: portrait) {
  .products-table {
    font-size: 0.5rem;
  }
  
  .products-table th,
  .products-table td {
    padding: 0.5px;
    font-size: 0.5rem;
  }
  
  .products-table input {
    font-size: 8px;
    min-height: 22px;
    padding: 0.5px;
  }
  
  .product-name-cell {
    font-size: 0.45rem !important;
    padding: 0.5px !important;
  }
  
  .header-row-1 th,
  .header-row-2 th {
    font-size: 0.45rem;
    padding: 0.5px;
  }
}

main {
  max-width: 1000px;
  margin: 16px auto 48px;
  padding: 0 12px;
  overflow-x: visible;
  width: 100%;
  box-sizing: border-box;
}

/* Tablet Main */
@media (min-width: 769px) and (max-width: 1024px) {
  main {
    max-width: 900px;
    margin: 20px auto 60px;
    padding: 0 20px;
  }
}

/* Mobile Main */
@media (max-width: 768px) {
  main {
    margin: 8px auto 24px;
    padding: 0 8px;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
  }
}

.card {
  background: #fff;
  padding: 16px;
  margin-bottom: 16px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  width: 100%;
  box-sizing: border-box;
  overflow: visible;
}

/* Mobile Card Styles */
@media (max-width: 768px) {
  .card {
    padding: 12px 8px;
    margin-bottom: 12px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  }
  
  .card h2 {
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #007bff;
  }
}

h2 {
  margin-top: 0;
  font-size: 1.2rem;
}

h3 {
  margin-bottom: 8px;
  color: #333;
  font-size: 1.1rem;
}

.invoice-header h3 {
  margin-top: 0;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid #007bff;
  color: #007bff;
}



.total-section {
  margin: 20px 0;
  padding: 16px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 8px;
  border: 2px solid #007bff;
}

.total-amount {
  font-size: 1.5rem;
  font-weight: bold;
  color: #007bff;
  margin: 0 8px;
}

.action-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #ddd;
}

/* FG Warehouse Styles */
.product-input-row {
  margin-bottom: 8px;
  padding: 8px;
  background: #f9f9f9;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
}

.product-input-row .form-row {
  margin-bottom: 0;
  align-items: center;
}

.distribution-info {
  background: #f8f9fa;
  padding: 16px;
  border-radius: 6px;
  margin-bottom: 16px;
}

.distribution-info h3 {
  margin-top: 0;
  color: #007bff;
  border-bottom: 2px solid #007bff;
  padding-bottom: 8px;
}

.distribution-info p {
  margin: 8px 0;
  font-size: 0.9rem;
}

.distribution-items h3 {
  color: #333;
  border-bottom: 2px solid #28a745;
  padding-bottom: 8px;
}

.status-active {
  background: #d4edda;
  color: #155724;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: bold;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.row label {
  flex: 1 1 220px;
}

/* Mobile Row Styles */
@media (max-width: 768px) {
  .row {
    flex-direction: column;
    gap: 8px;
  }
  
  .row label {
    flex: 1 1 100%;
  }
  
  /* Form buttons on mobile */
  .row button {
    width: 100%;
    margin-bottom: 8px;
  }
  
  /* Search controls on mobile */
  #search-tab .row {
    gap: 12px;
  }
  
  #search-tab .row label {
    flex: 1 1 100%;
  }
  
  #search-tab .row button {
    flex: 1 1 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: bold;
  }
  
  /* Total row on mobile */
  .total-row {
    flex-direction: column;
    align-items: center;
    text-align: center;
    font-size: 1.1rem;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
  }
}

/* Tablet Optimization - Responsive Design */
@media (min-width: 769px) and (max-width: 1024px) {
  body {
    overflow-x: hidden;
    width: 100vw;
  }
  
  main {
    max-width: 100%;
    padding: 0 10px;
    margin: 10px auto;
    box-sizing: border-box;
  }
  
  .card {
    padding: 15px;
    margin-bottom: 15px;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
  }
  
  .card h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    text-align: center;
    color: #007bff;
  }
  
  .products-section {
    overflow-x: hidden;
    width: 100%;
    margin: 0;
    padding: 0;
  }
  
  .products-section h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #333;
    text-align: center;
  }
  
  .invoice-header .row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
  }
  
  .invoice-header .row label {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
  }
  
  .invoice-header .row input,
  .invoice-header .row select {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    min-height: 48px;
    border-radius: 6px;
    border: 2px solid #ddd;
    transition: border-color 0.2s;
  }
  
  .invoice-header .row input:focus,
  .invoice-header .row select:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
  }
  
  /* Products table for tablet - Responsive fit */
  .products-table-container {
    margin: 10px 0;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  .products-table {
    font-size: 0.7rem;
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    min-width: 100%;
  }
  
  .products-table th,
  .products-table td {
    padding: 4px 2px;
    font-size: 0.65rem;
    text-align: center;
    vertical-align: middle;
    border: 1px solid #ddd;
    white-space: nowrap;
    overflow: hidden;
  }
  
  .products-table input {
    width: 100%;
    padding: 3px 1px;
    font-size: 11px;
    min-height: 28px;
    border-radius: 2px;
    border: 1px solid #ccc;
    text-align: center;
    box-sizing: border-box;
  }
  
  .product-name-cell {
    font-size: 0.6rem !important;
    padding: 4px 2px !important;
    width: 30% !important;
    text-align: left !important;
    word-break: break-word;
    line-height: 1.0;
    white-space: normal;
  }
  
  /* Tablet column widths - responsive fit */
  .col-product-name { 
    width: 30% !important;
    min-width: 30% !important;
    max-width: 30% !important;
  }
  
  .col-data1, .col-data2, .col-data3 { 
    width: 23.33% !important;
    min-width: 23.33% !important;
    max-width: 23.33% !important;
  }
  
  /* Header styling for tablet */
  .header-row-1 th {
    background: #007bff !important;
    color: white !important;
    font-size: 0.6rem;
    padding: 3px 2px;
    font-weight: bold;
    white-space: nowrap;
  }
  
  .header-row-2 th {
    background: #0056b3 !important;
    color: white !important;
    font-size: 0.55rem;
    padding: 3px 2px;
    font-weight: bold;
    white-space: nowrap;
  }
  
  /* Row styling for tablet */
  .product-row-sell td {
    background: #fff;
    padding: 10px 6px;
  }
  
  .product-row-exchange td {
    background: #f8f9fa;
    border-top: 1px dashed #007bff;
    padding: 8px 6px;
    font-size: 0.75rem;
  }
  
  /* Total section for tablet */
  .total-row {
    justify-content: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 18px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    margin: 18px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
  }
  
  /* Ensure products section fits tablet width */
  .products-table-container {
    max-width: 100%;
    overflow-x: hidden;
    width: 100%;
  }
  
  .products-table {
    min-width: 100%;
    max-width: 100%;
    width: 100%;
  }
}

/* Tablet Portrait Mode - Extra Responsive */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait) {
  .products-table-container {
    margin: 5px 0;
    padding: 0;
  }
  
  .products-table {
    font-size: 0.65rem;
  }
  
  .products-table th,
  .products-table td {
    padding: 3px 1px;
    font-size: 0.6rem;
  }
  
  .products-table input {
    padding: 2px 1px;
    font-size: 10px;
    min-height: 26px;
  }
  
  .product-name-cell {
    font-size: 0.55rem !important;
    padding: 3px 1px !important;
  }
  
  .header-row-1 th,
  .header-row-2 th {
    font-size: 0.55rem;
    padding: 2px 1px;
  }
  
  /* Action buttons for tablet */
  .row button {
    padding: 14px 28px;
    font-size: 18px;
    min-height: 52px;
    border-radius: 8px;
    font-weight: 600;
    margin: 0 8px;
    transition: all 0.2s;
  }
  
  .row button.primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
  }
  
  .row button.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.4);
  }
  
  .row button.secondary:hover {
    background: #d4d4d4;
    transform: translateY(-1px);
  }
}

/* Mobile Portrait - Paired Form Fields */
@media (max-width: 768px) and (orientation: portrait) {
  .invoice-header .row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
  }
  
  .invoice-header .row label {
    flex: 1;
    font-size: 0.9rem;
  }
  
  .invoice-header .row input,
  .invoice-header .row select {
    width: 100%;
    padding: 8px;
    font-size: 14px;
    min-height: 40px;
  }
  
  /* Ensure proper pairing on mobile portrait */
  .invoice-header .row:nth-child(1) {
    /* วันที่ + เวลา */
  }
  
  .invoice-header .row:nth-child(2) {
    /* เลขที่เอกสาร + ชื่อลูกค้า */
  }
  
  .invoice-header .row:nth-child(3) {
    /* อำเภอ + ผู้ออกบิล */
  }
}

input[type="text"],
input[type="date"],
input[type="number"],
select {
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 16px; /* ป้องกัน zoom ใน iOS */
  min-height: 44px; /* Touch target size */
}

button {
  cursor: pointer;
  border-radius: 6px;
  padding: 8px 16px;
  border: none;
  font-size: 16px;
  min-height: 44px; /* Touch target size */
  touch-action: manipulation; /* ป้องกัน double-tap zoom */
}

/* Tablet Input & Button Styles */
@media (min-width: 769px) and (max-width: 1024px) {
  input[type="text"],
  input[type="date"],
  input[type="number"],
  select {
    padding: 12px 16px;
    font-size: 16px;
    min-height: 48px;
    border-radius: 6px;
    border: 2px solid #ddd;
    transition: all 0.2s;
  }
  
  input[type="text"]:focus,
  input[type="date"]:focus,
  input[type="number"]:focus,
  select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    outline: none;
  }
  
  button {
    padding: 14px 28px;
    font-size: 18px;
    min-height: 52px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
  }
  
  button:hover {
    transform: translateY(-1px);
  }
}

/* Mobile Input & Button Styles */
@media (max-width: 768px) {
  input[type="text"],
  input[type="date"],
  input[type="number"],
  select {
    padding: 12px 16px;
    font-size: 16px;
    min-height: 48px;
  }
  
  button {
    padding: 12px 20px;
    font-size: 16px;
    min-height: 48px;
    width: 100%;
    margin-bottom: 8px;
  }
}

button.primary {
  background: #007bff;
  color: #fff;
}

button.secondary {
  background: #e0e0e0;
  color: #333;
}

button.danger {
  background: #e53935;
  color: #fff;
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
  overflow-x: auto;
}

.items-table th,
.items-table td {
  border: 1px solid #ddd;
  padding: 8px 6px;
  text-align: center;
  font-size: 0.9rem;
}

.items-table td button {
  font-size: 0.8rem;
  padding: 6px 12px;
  margin: 2px;
  min-height: 36px;
}

.items-table th {
  background: #f1f1f1;
  font-weight: bold;
}

/* Table Container */
.items-table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 6px;
  border: 1px solid #ddd;
  position: relative;
}

.items-table-container::after {
  content: "← เลื่อนดูเพิ่มเติม →";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 123, 255, 0.1);
  color: #007bff;
  text-align: center;
  padding: 4px;
  font-size: 0.7rem;
  display: none;
}

@media (max-width: 768px) {
  .items-table-container::after {
    display: block;
  }
}

/* Mobile Table Styles */
@media (max-width: 768px) {
  .items-table-container {
    margin: 0 -8px; /* ขยายให้เต็มความกว้าง */
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  
  .items-table {
    min-width: 700px; /* เพิ่มความกว้างสำหรับคอลัมน์สถานะ */
    font-size: 0.8rem;
  }
  
  .items-table th,
  .items-table td {
    padding: 10px 6px;
    font-size: 0.8rem;
    white-space: nowrap;
  }
  
  .items-table th {
    background: #007bff;
    color: white;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
  }
  
  .items-table td button {
    font-size: 0.7rem;
    padding: 6px 8px;
    margin: 1px;
    min-height: 36px;
    border-radius: 4px;
  }
  
  /* ปรับขนาดคอลัมน์ */
  .items-table th:nth-child(1),
  .items-table td:nth-child(1) { width: 80px; } /* เลขบิล */
  
  .items-table th:nth-child(2),
  .items-table td:nth-child(2) { width: 100px; } /* วันที่ */
  
  .items-table th:nth-child(3),
  .items-table td:nth-child(3) { 
    width: 120px; 
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
  } /* ชื่อลูกค้า */
  
  .items-table th:nth-child(4),
  .items-table td:nth-child(4) { width: 100px; } /* ยอดรวม */
  
  .items-table th:nth-child(5),
  .items-table td:nth-child(5) { width: 80px; } /* สถานะ */
  
  .items-table th:nth-child(6),
  .items-table td:nth-child(6) { 
    width: 140px; 
    min-width: 140px;
  } /* จัดการ */
}

/* Action Buttons Container */
.action-buttons {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.action-btn {
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  min-height: 32px;
  white-space: nowrap;
}

/* Invoice Status Styles */
.status-active {
  background: #d4edda;
  color: #155724;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: bold;
}

.status-cancelled {
  background: #f8d7da;
  color: #721c24;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: bold;
}

.cancelled-row {
  /* เปลี่ยนแค่สีพื้นหลังเล็กน้อยเพื่อแยกแยะ */
  background-color: #f8f9fa;
}

.cancelled-row td {
  /* ไม่ใส่เส้นขีดทับหรือเปลี่ยนสี เพื่อให้ใช้งานได้ปกติ */
}

.cancelled-row .status-cancelled {
  /* สถานะยกเลิกจะแสดงสีแดงตามปกติ */
}

/* Mobile Action Buttons */
@media (max-width: 768px) {
  .action-buttons {
    flex-direction: column;
    gap: 4px;
    width: 100%;
  }
  
  .action-btn {
    width: 100%;
    font-size: 0.7rem;
    padding: 8px 6px;
    min-height: 36px;
  }
}

.total-row {
  justify-content: flex-end;
  gap: 4px;
  font-weight: bold;
}

/* Summary row */
.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 8px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #e9ecef;
}

/* Mobile Summary Row */
@media (max-width: 768px) {
  .summary-row {
    flex-direction: column;
    gap: 8px;
    text-align: center;
    font-size: 1rem;
    padding: 16px;
  }
  
  .summary-row span {
    display: block;
    padding: 4px 0;
  }
  
  .summary-row strong {
    font-size: 1.2rem;
    color: #007bff;
  }
}

/* ใบปริ้น */
#print-area {
  padding: 8px;
}

#print-area h3 {
  text-align: center;
}

#print-area table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

#print-area th,
#print-area td {
  border: 1px solid #000;
  padding: 4px;
  font-size: 0.8rem;
}

/* Invoice Detail Styles */
.invoice-info-table {
  width: 100%;
  margin-bottom: 16px;
  border-collapse: collapse;
}

.invoice-info-table td {
  padding: 8px;
  border: 1px solid #ddd;
  font-size: 0.9rem;
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.invoice-table th,
.invoice-table td {
  border: 1px solid #000;
  padding: 6px;
  text-align: center;
  font-size: 0.85rem;
}

.invoice-table th {
  background: #f1f1f1;
  font-weight: bold;
}

/* Invoice Status Styles */
.invoice-status {
  background: #fff;
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  border: 2px solid #ddd;
  text-align: center;
}

.invoice-status h4 {
  margin: 0;
  font-size: 1.1rem;
}

.status-pending {
  color: #6c757d;
  background: #f8f9fa;
  padding: 4px 12px;
  border-radius: 4px;
}

.status-cash {
  color: #28a745;
  background: #d4edda;
  padding: 4px 12px;
  border-radius: 4px;
  font-weight: bold;
}

.status-transfer {
  color: #007bff;
  background: #d1ecf1;
  padding: 4px 12px;
  border-radius: 4px;
  font-weight: bold;
}

.status-paid {
  color: #28a745;
  background: #d4edda;
  padding: 4px 12px;
  border-radius: 4px;
  font-weight: bold;
}

.status-credit {
  color: #dc3545;
  background: #f8d7da;
  padding: 4px 12px;
  border-radius: 4px;
  font-weight: bold;
}

.status-partial {
  color: #fd7e14;
  background: #fff3cd;
  padding: 4px 12px;
  border-radius: 4px;
  font-weight: bold;
}

/* Payment Form Styles */
.payment-form {
  background: #f8f9fa;
  padding: 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  border: 2px solid #007bff;
}

.payment-row {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.payment-row label {
  flex: 1;
  min-width: 200px;
}

.payment-row input,
.payment-row select {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

.payment-row strong {
  color: #007bff;
  font-size: 1.1rem;
}

/* Mobile Payment Form */
@media (max-width: 768px) {
  .payment-form {
    padding: 12px;
  }
  
  .payment-row {
    flex-direction: column;
    gap: 8px;
  }
  
  .payment-row label {
    width: 100%;
    min-width: auto;
  }
}

/* โหมดพิมพ์ */
@media print {
  body * {
    visibility: hidden;
  }
  #invoice-detail-card, #invoice-detail-card * {
    visibility: visible;
  }
  #invoice-detail-card {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    box-shadow: none;
    background: white;
  }
  
  /* ซ่อนปุ่มควบคุม */
  #close-detail-btn, #print-btn {
    display: none !important;
  }
  
  /* แสดงข้อมูลการชำระเงินในการพิมพ์ */
  .payment-form {
    background: white !important;
    border: 1px solid #000 !important;
    page-break-inside: avoid;
  }
  
  .payment-form input,
  .payment-form select {
    border: none !important;
    background: transparent !important;
    font-weight: bold;
  }
  
  /* ปรับแต่งสถานะสำหรับการพิมพ์ */
  .invoice-status {
    border: 1px solid #000 !important;
    background: white !important;
  }
  
  /* ปรับขนาดตัวอักษรสำหรับการพิมพ์ */
  #print-area {
    font-size: 12px;
  }
  
  #print-area h3 {
    font-size: 16px;
    margin-bottom: 10px;
  }
  
  #print-area h4 {
    font-size: 14px;
    margin: 10px 0 5px 0;
  }
}
/* User Management Styles */
.permissions-section {
  margin-top: 20px;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
  background-color: #f9f9f9;
}

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

.permission-category {
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 10px;
  background-color: white;
}

.permission-category h4 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 14px;
  font-weight: bold;
}

.permission-item {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  padding: 5px;
  border-radius: 3px;
}

.permission-item:hover {
  background-color: #f0f0f0;
}

.permission-item input[type="checkbox"] {
  margin-right: 8px;
}

.permission-item label {
  font-size: 13px;
  cursor: pointer;
  flex: 1;
}

.bulk-actions {
  margin-bottom: 20px;
  padding: 15px;
  background-color: #f5f5f5;
  border-radius: 5px;
}

.bulk-actions h3 {
  margin: 0 0 10px 0;
  color: #333;
}

/* Modal Styles */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: white;
  border-radius: 8px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #ddd;
  background-color: #f8f9fa;
  border-radius: 8px 8px 0 0;
}

.modal-header h2 {
  margin: 0;
  color: #333;
}

.close {
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: #aaa;
  line-height: 1;
}

.close:hover {
  color: #000;
}

.modal-body {
  padding: 20px;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #ddd;
}

/* User table enhancements */
.items-table th:first-child,
.items-table td:first-child {
  width: 40px;
  text-align: center;
}

.user-status {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
}

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

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

.permission-count {
  font-size: 12px;
  color: #666;
  font-style: italic;
}

/* Mobile responsive for modals */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 10px;
  }
  
  .permissions-grid {
    grid-template-columns: 1fr;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .form-actions button {
    width: 100%;
    margin-bottom: 10px;
  }
}
/* User Management Styles */
.form-row label {
  display: block;
  font-weight: bold;
  margin-bottom: 5px;
  color: #333;
}

.permission-note {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 15px;
  font-style: italic;
}

.permissions-section {
  margin-top: 20px;
  padding: 15px;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.permissions-section h3, .permissions-section h4 {
  margin-top: 0;
  color: #333;
}

.permission-categories {
  display: grid;
  gap: 20px;
  margin-top: 15px;
}

.permission-category {
  background: white;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.permission-category h5 {
  margin: 0 0 10px 0;
  color: #2c5aa0;
  font-size: 1rem;
}

.permission-items {
  display: grid;
  gap: 8px;
}

.permission-items label {
  display: flex;
  align-items: center;
  font-weight: normal;
  cursor: pointer;
  padding: 5px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.permission-items label:hover {
  background-color: #f0f0f0;
}

.permission-items input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.1);
}

.permission-filter {
  background: #f0f8ff;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid #b3d9ff;
}

.permission-filter h3 {
  margin-top: 0;
  color: #1a5490;
}

.permission-results {
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #ddd;
  margin-bottom: 20px;
}

.users-permission-list {
  display: grid;
  gap: 10px;
}

.user-permission-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  cursor: pointer;
  transition: all 0.2s;
}

.user-permission-item:hover {
  background: #e8f4fd;
  border-color: #2c5aa0;
}

.user-permission-item.selected {
  background: #d4edda;
  border-color: #28a745;
}

.user-info {
  flex: 1;
}

.user-info .user-name {
  font-weight: bold;
  color: #333;
}

.user-info .user-details {
  font-size: 0.9rem;
  color: #666;
  margin-top: 2px;
}

.permission-count {
  background: #2c5aa0;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
}

.form-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

#permission-assignment-form {
  background: white;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #ddd;
  margin-top: 20px;
}

#selected-user-info {
  color: #2c5aa0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .permission-categories {
    grid-template-columns: 1fr;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .form-actions button {
    width: 100%;
  }
  
  .user-permission-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* Enhanced form styling */
.form-row {
  margin-bottom: 15px;
}

.form-row input[type="password"] {
  margin-right: 10px;
}

.form-row input[type="password"]:last-child {
  margin-right: 0;
}

/* User status indicators */
.user-status {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
}

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

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

/* Permission grid improvements */
.permissions-grid {
  display: grid;
  gap: 15px;
  margin-top: 10px;
}

.permissions-grid .permission-category {
  margin-bottom: 0;
}

/* Better button spacing */
.form-row button {
  margin-left: 10px;
}

.form-row button:first-child {
  margin-left: 0;
}
/* System Permission Styles */
.system-permissions {
  margin-bottom: 20px;
}

.system-items {
  display: grid;
  gap: 15px;
  margin-top: 10px;
}

.system-access {
  display: flex;
  align-items: flex-start;
  padding: 15px;
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: normal;
}

.system-access:hover {
  border-color: #2c5aa0;
  background: #f8f9ff;
}

.system-access input[type="checkbox"] {
  margin-right: 15px;
  margin-top: 5px;
  transform: scale(1.2);
}

.system-access input[type="checkbox"]:checked + .system-info {
  color: #2c5aa0;
}

.system-access:has(input:checked) {
  border-color: #2c5aa0;
  background: #f0f8ff;
  box-shadow: 0 2px 8px rgba(44, 90, 160, 0.1);
}

.system-info {
  flex: 1;
}

.system-name {
  font-weight: bold;
  font-size: 1.1rem;
  margin-bottom: 5px;
  color: #333;
}

.system-desc {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.4;
}

.system-details {
  margin-top: 20px;
  padding: 20px;
  background: #f9f9f9;
  border-radius: 10px;
  border-left: 4px solid #2c5aa0;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.system-details .permission-categories {
  display: grid;
  gap: 15px;
}

.system-details .permission-category {
  background: white;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.system-details .permission-category h5 {
  margin: 0 0 10px 0;
  color: #2c5aa0;
  font-size: 1rem;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 5px;
}

/* Enhanced checkbox styling */
.permission-items input[type="checkbox"] {
  accent-color: #2c5aa0;
}

.permission-items label:has(input:checked) {
  background-color: #e8f4fd;
  border-radius: 4px;
}

/* Responsive design for system permissions */
@media (max-width: 768px) {
  .system-access {
    flex-direction: column;
    text-align: center;
  }
  
  .system-access input[type="checkbox"] {
    margin-right: 0;
    margin-bottom: 10px;
  }
  
  .system-details .permission-categories {
    grid-template-columns: 1fr;
  }
}

/* Better visual hierarchy */
.permissions-section h4 {
  color: #1a5490;
  border-bottom: 2px solid #2c5aa0;
  padding-bottom: 8px;
  margin-bottom: 20px;
}

.permissions-section h5 {
  color: #2c5aa0;
  margin-bottom: 15px;
}

/* Status indicators */
.system-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
  margin-left: 10px;
}

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

.system-status.disabled {
  background: #f8d7da;
  color: #721c24;
}
/* Product Zones Management Styles */
.zones-selection {
  margin-top: 10px;
}

.zone-checkbox {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  font-weight: normal;
  cursor: pointer;
}

.zone-checkbox input[type="checkbox"] {
  margin-right: 8px;
  transform: scale(1.1);
}

.zone-checkbox span {
  color: #333;
}

#individual-zones {
  margin-left: 20px;
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.zones-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 15px;
}

.zone-option {
  display: flex;
  align-items: flex-start;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

.zone-option:hover {
  border-color: #2c5aa0;
  background: #f8f9ff;
}

.zone-option.all-zones {
  background: #f0f8ff;
  border-color: #2c5aa0;
}

.zone-option input[type="checkbox"] {
  margin-right: 12px;
  margin-top: 2px;
  transform: scale(1.2);
}

.zone-option:has(input:checked) {
  border-color: #2c5aa0;
  background: #e8f4fd;
}

.zone-info {
  flex: 1;
}

.zone-name {
  font-weight: bold;
  color: #333;
  display: block;
  margin-bottom: 4px;
}

.zone-desc {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.3;
}

.zone-code {
  font-family: monospace;
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
  color: #666;
}

.product-info-display {
  background: #f9f9f9;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  border-left: 4px solid #2c5aa0;
}

.product-info-display h3 {
  margin: 0 0 8px 0;
  color: #2c5aa0;
}

.product-info-display p {
  margin: 0;
  color: #666;
}

.zones-management h4 {
  color: #333;
  margin-bottom: 15px;
}

.zones-management h5 {
  color: #666;
  margin: 15px 0 10px 0;
  font-size: 0.9rem;
}

.individual-zones-container {
  margin-top: 20px;
}

.zone-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
}

.zone-tag {
  background: #2c5aa0;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
}

.zone-tag.all-zones {
  background: #28a745;
}

.zone-tag.limited {
  background: #ffc107;
  color: #333;
}

/* Product table enhancements */
.product-zones-cell {
  max-width: 200px;
}

.zones-summary {
  font-size: 0.9rem;
}

.zones-count {
  background: #e9ecef;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
  color: #495057;
  margin-right: 5px;
}

/* Responsive design */
@media (max-width: 768px) {
  .zones-grid {
    grid-template-columns: 1fr;
  }
  
  #individual-zones {
    grid-template-columns: 1fr;
    margin-left: 10px;
  }
  
  .zone-option {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .zone-option input[type="checkbox"] {
    margin-bottom: 8px;
  }
}
/* Invoice Header Styles */
.invoice-header {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid #e9ecef;
}

.invoice-header .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 15px;
}

.invoice-header .row:last-child {
  margin-bottom: 0;
}

.invoice-header label {
  font-weight: bold;
  color: #495057;
}

/* Products Section Styles */
.products-section {
  margin-bottom: 20px;
}

.products-table-container {
  max-height: 600px;
  overflow-y: auto;
  border: 1px solid #dee2e6;
  border-radius: 8px;
}

.products-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.products-table thead {
  background: #343a40;
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

.products-table thead th {
  padding: 12px 8px;
  text-align: center;
  font-weight: bold;
  border-right: 1px solid #495057;
}

.products-table thead th:last-child {
  border-right: none;
}

.products-table tbody tr {
  border-bottom: 1px solid #dee2e6;
}

.products-table tbody tr:hover {
  background-color: #f8f9fa;
}

.products-table tbody td {
  padding: 8px;
  vertical-align: middle;
  border-right: 1px solid #dee2e6;
}

.products-table tbody td:last-child {
  border-right: none;
}

.product-name-cell {
  text-align: left;
  font-weight: 500;
}

.product-name-cell small {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
}

.price-cell {
  text-align: right;
  font-weight: bold;
  color: #28a745;
  background-color: #f8fff9;
}

.products-table input[type="number"] {
  width: 100%;
  padding: 6px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  text-align: right;
  font-size: 0.9rem;
}

.products-table input[type="number"]:focus {
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
  outline: none;
}

.products-table input[readonly] {
  background-color: #e9ecef;
  border-color: #ced4da;
}

.amount-input {
  font-weight: bold;
  color: #dc3545;
}

/* Responsive Design for Products Table */
@media (max-width: 1200px) {
  .products-table {
    font-size: 0.85rem;
  }
  
  .products-table thead th,
  .products-table tbody td {
    padding: 6px 4px;
  }
  
  .products-table input[type="number"] {
    padding: 4px;
    font-size: 0.8rem;
  }
}

/* iPad และ Tablet */
@media (max-width: 1024px) {
  .products-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .products-table {
    min-width: 800px;
    font-size: 0.8rem;
  }
  
  .products-table thead th {
    white-space: nowrap;
    font-size: 0.75rem;
    padding: 8px 4px;
    background: #343a40;
    position: sticky;
    top: 0;
    z-index: 20;
  }
  
  .products-table tbody td {
    padding: 6px 4px;
    white-space: nowrap;
  }
  
  .product-name-cell {
    min-width: 180px;
    max-width: 200px;
  }
  
  .product-name-cell small {
    font-size: 0.7rem;
  }
}

/* โทรศัพท์มือถือ */
@media (max-width: 768px) {
  .invoice-header .row {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .products-table-container {
    max-height: 60vh;
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border: 2px solid #dee2e6;
    width: 100%;
  }
  
  .products-table {
    width: 100%;
    min-width: 700px;
    font-size: 0.75rem;
    table-layout: auto;
  }
  
  .products-table thead {
    background: #343a40;
    position: sticky;
    top: 0;
    z-index: 30;
  }
  
  .products-table thead th {
    background: #343a40 !important;
    color: white !important;
    font-weight: bold;
    font-size: 0.7rem;
    padding: 12px 6px;
    text-align: center;
    white-space: nowrap;
    border-right: 1px solid #495057;
    position: sticky;
    top: 0;
    z-index: 30;
  }
  
  .products-table tbody td {
    padding: 10px 6px;
    font-size: 0.75rem;
    vertical-align: middle;
  }
  
  .product-name-cell {
    min-width: 180px;
    background: white;
    z-index: 10;
    border-right: 2px solid #dee2e6;
  }
  
  .product-name-cell strong {
    font-size: 0.75rem;
    display: block;
    margin-bottom: 4px;
    line-height: 1.2;
  }
  
  .product-name-cell small {
    font-size: 0.65rem;
    color: #666;
    display: block;
    line-height: 1.1;
  }
  
  .products-table input[type="number"] {
    width: 100%;
    min-width: 60px;
    padding: 8px 4px;
    font-size: 0.7rem;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
  }
  
  .price-cell {
    font-size: 0.7rem;
    font-weight: bold;
    text-align: center;
    min-width: 70px;
    padding: 10px 6px;
  }
}

/* โทรศัพท์ขนาดเล็ก */
@media (max-width: 480px) {
  .products-table {
    min-width: 600px;
    font-size: 0.7rem;
  }
  
  .products-table thead th {
    font-size: 0.65rem;
    padding: 10px 4px;
    line-height: 1.2;
  }
  
  .products-table tbody td {
    padding: 8px 4px;
    font-size: 0.7rem;
  }
  
  .product-name-cell {
    min-width: 160px;
    font-size: 0.7rem;
  }
  
  .product-name-cell strong {
    font-size: 0.7rem;
    margin-bottom: 3px;
  }
  
  .product-name-cell small {
    font-size: 0.6rem;
  }
  
  .products-table input[type="number"] {
    min-width: 50px;
    padding: 6px 3px;
    font-size: 0.65rem;
  }
  
  .price-cell {
    min-width: 60px;
    font-size: 0.65rem;
  }
}

/* Enhanced Total Row */
.total-row {
  background: #e9ecef;
  padding: 15px 20px;
  border-radius: 8px;
  margin: 20px 0;
  font-size: 1.2rem;
  font-weight: bold;
  text-align: right;
  border: 2px solid #28a745;
}

.total-row span:last-child {
  color: #28a745;
  font-size: 1.4rem;
}
/* เพิ่มการแสดงผลที่ดีขึ้นสำหรับ Mobile */
.products-section h3 {
  margin-bottom: 10px;
  color: #343a40;
}

/* Mobile: เพิ่มคำแนะนำการใช้งาน */
@media (max-width: 768px) {
  .products-section::before {
    content: "💡 เลื่อนตารางซ้าย-ขวาเพื่อดูคอลัมน์ทั้งหมด";
    display: block;
    background: #e3f2fd;
    color: #1976d2;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 10px;
    text-align: center;
    border: 1px solid #bbdefb;
  }
  
  /* ปรับปรุงการแสดงผลหัวตาราง */
  .products-table thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 31;
    background: #343a40 !important;
    border-right: 2px solid #495057;
  }
  
  /* เพิ่มเงาให้คอลัมน์แรก */
  .product-name-cell {
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
  }
  
  /* ปรับปรุงการแสดงผลของ input */
  .products-table input[type="number"]:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
    outline: none;
    transform: scale(1.05);
    z-index: 100;
    position: relative;
  }
}

/* เพิ่มการรองรับ Touch สำหรับ iPad */
@media (max-width: 1024px) and (orientation: portrait) {
  .products-table-container {
    max-height: 500px;
  }
  
  .products-table input[type="number"] {
    min-height: 36px; /* เพิ่มขนาดสำหรับ touch */
    font-size: 16px; /* ป้องกัน zoom ใน iOS */
  }
}

@media (max-width: 1024px) and (orientation: landscape) {
  .products-table-container {
    max-height: 300px;
  }
}

/* ปรับปรุงการแสดงผลใน Safari iOS */
@supports (-webkit-touch-callout: none) {
  .products-table-container {
    -webkit-overflow-scrolling: touch;
  }
  
  .products-table input[type="number"] {
    -webkit-appearance: none;
    border-radius: 4px;
  }
}
/* Header Classes สำหรับตาราง */
.product-name-header {
  width: 250px;
  min-width: 200px;
  background: #343a40 !important;
  color: white !important;
}

.number-header {
  width: 80px;
  min-width: 70px;
  background: #343a40 !important;
  color: white !important;
}

.price-header {
  width: 100px;
  min-width: 90px;
  background: #28a745 !important;
  color: white !important;
}

.amount-header {
  width: 120px;
  min-width: 100px;
  background: #dc3545 !important;
  color: white !important;
}

/* Mobile: ปรับขนาดหัวตาราง */
@media (max-width: 768px) {
  .product-name-header {
    min-width: 180px !important;
    font-size: 0.7rem !important;
    padding: 12px 6px !important;
    line-height: 1.2;
  }
  
  .number-header {
    min-width: 70px !important;
    font-size: 0.65rem !important;
    padding: 12px 4px !important;
    line-height: 1.2;
  }
  
  .price-header {
    min-width: 70px !important;
    font-size: 0.65rem !important;
    padding: 12px 4px !important;
    line-height: 1.2;
  }
  
  .amount-header {
    min-width: 90px !important;
    font-size: 0.65rem !important;
    padding: 12px 4px !important;
    line-height: 1.2;
  }
}

/* เพิ่มการแสดงผลที่ชัดเจนขึ้น */
@media (max-width: 480px) {
  .products-table thead th {
    font-weight: bold !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  
  .product-name-header {
    background: #2c3e50 !important;
  }
  
  .number-header {
    background: #34495e !important;
  }
  
  .price-header {
    background: #27ae60 !important;
  }
  
  .amount-header {
    background: #e74c3c !important;
  }
}
/* ปรับปรุงการแสดงผลตารางในโทรศัพท์ */
@media (max-width: 768px) {
  /* ลบ min-width เพื่อให้ตารางพอดีหน้าจอ */
  .products-table-container {
    overflow-x: hidden;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    padding: 0 10px;
  }
  
  /* ปรับขนาดคอลัมน์ให้พอดีหน้าจอ */
  .products-table colgroup col:nth-child(1) { width: 35%; } /* รายการสินค้า */
  .products-table colgroup col:nth-child(2) { width: 9%; }  /* เปลี่ยน */
  .products-table colgroup col:nth-child(3) { width: 9%; }  /* แถม */
  .products-table colgroup col:nth-child(4) { width: 9%; }  /* คืน */
  .products-table colgroup col:nth-child(5) { width: 9%; }  /* ขาย */
  .products-table colgroup col:nth-child(6) { width: 8%; }  /* ราคา */
  .products-table colgroup col:nth-child(7) { width: 9%; }  /* ส่วนลด */
  .products-table colgroup col:nth-child(8) { width: 12%; } /* จำนวนเงิน */
}

@media (max-width: 480px) {
  .products-table-container {
    padding: 0 5px;
  }
  
  /* ปรับขนาดคอลัมน์สำหรับหน้าจอเล็ก */
  .products-table colgroup col:nth-child(1) { width: 40%; } /* รายการสินค้า */
  .products-table colgroup col:nth-child(2) { width: 8%; }  /* เปลี่ยน */
  .products-table colgroup col:nth-child(3) { width: 8%; }  /* แถม */
  .products-table colgroup col:nth-child(4) { width: 8%; }  /* คืน */
  .products-table colgroup col:nth-child(5) { width: 8%; }  /* ขาย */
  .products-table colgroup col:nth-child(6) { width: 7%; }  /* ราคา */
  .products-table colgroup col:nth-child(7) { width: 8%; }  /* ส่วนลด */
  .products-table colgroup col:nth-child(8) { width: 13%; } /* จำนวนเงิน */
}

/* ปรับปรุงการแสดงผลข้อความในตาราง */
@media (max-width: 768px) {
  .products-table thead th {
    word-break: break-word;
    hyphens: auto;
  }
  
  /* ย่อชื่อคอลัมน์ในโทรศัพท์ */
  .products-table thead th:nth-child(2)::after { content: "เปลี่ยน"; }
  .products-table thead th:nth-child(3)::after { content: "แถม"; }
  .products-table thead th:nth-child(4)::after { content: "คืน"; }
  .products-table thead th:nth-child(5)::after { content: "ขาย"; }
  .products-table thead th:nth-child(6)::after { content: "ราคา"; }
  .products-table thead th:nth-child(7)::after { content: "ส่วนลด"; }
  .products-table thead th:nth-child(8)::after { content: "รวม"; }
}

/* ปรับปรุง input ให้ใช้งานง่ายในโทรศัพท์ */
@media (max-width: 768px) {
  .products-table input[type="number"] {
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: none;
    background: white;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px; /* ป้องกัน zoom ใน iOS */
  }
  
  .products-table input[type="number"]:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 1px rgba(0, 123, 255, 0.25);
    outline: none;
  }
}
/* กำหนดขนาดคอลัมน์ผ่าน colgroup */
.col-product-name { width: 280px; }
.col-change { width: 90px; }
.col-free { width: 90px; }
.col-return { width: 90px; }
.col-sell { width: 90px; }
.col-discount { width: 90px; }
.col-amount { width: 130px; }

/* Mobile: ปรับขนาดคอลัมน์ให้พอดีหน้าจอ */
@media (max-width: 768px) {
  .col-product-name { min-width: 180px; }
  .col-change { min-width: 70px; }
  .col-free { min-width: 70px; }
  .col-return { min-width: 70px; }
  .col-sell { min-width: 70px; }
  .col-price { min-width: 70px; }
  .col-discount { min-width: 70px; }
  .col-amount { min-width: 90px; }
}

@media (max-width: 480px) {
  .col-product-name { min-width: 160px; }
  .col-change { min-width: 60px; }
  .col-free { min-width: 60px; }
  .col-return { min-width: 60px; }
  .col-sell { min-width: 60px; }
  .col-price { min-width: 60px; }
  .col-discount { min-width: 60px; }
  .col-amount { min-width: 80px; }
}

/* ปรับ container ให้เลื่อนได้ */
@media (max-width: 768px) {
  .products-table-container {
    overflow-x: auto;
    width: 100%;
    margin-left: 0;
  }
  
  /* เพิ่มคำแนะนำการเลื่อน */
  .products-section::after {
    content: "👆 เลื่อนตารางซ้าย-ขวาเพื่อดูคอลัมน์ทั้งหมด";
    display: block;
    background: #fff3cd;
    color: #856404;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-top: 10px;
    text-align: center;
    border: 1px solid #ffeaa7;
  }
}
/* ===== Sales Setup Zone Preview ===== */
.zone-preview {
  margin-top: 20px;
  animation: fadeIn 0.3s ease-in;
}

.zone-info-tabs {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
  flex: 1;
  padding: 12px 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
}

.tab-btn:hover {
  background-color: #f5f5f5;
  color: #333;
}

.tab-btn.active {
  color: #2196F3;
  border-bottom-color: #2196F3;
  background-color: #f8f9fa;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-in;
}

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

.tab-content h4 {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 16px;
  font-weight: 600;
}

.preview-list {
  max-height: 400px;
  overflow-y: auto;
}

/* Products Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 15px;
}

.product-item {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 15px;
  transition: all 0.3s ease;
}

.product-item:hover {
  background: #e3f2fd;
  border-color: #2196F3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.15);
}

.product-name {
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  font-size: 14px;
}

.product-details {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
}

.product-code {
  color: #666;
}

.product-price {
  color: #4CAF50;
  font-weight: 600;
}

.product-category {
  background: #2196F3;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  display: inline-block;
}

/* Customers Grid */
.customers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.customer-item {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 12px;
  transition: all 0.3s ease;
}

.customer-item:hover {
  background: #fff3e0;
  border-color: #FF9800;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(255, 152, 0, 0.15);
}

.customer-name {
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
  font-size: 14px;
}

.customer-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.customer-district {
  color: #666;
}

.customer-address {
  color: #888;
  font-style: italic;
}

/* Status Messages */
.loading {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 20px;
}

.no-data {
  text-align: center;
  color: #999;
  padding: 20px;
  background: #f5f5f5;
  border-radius: 8px;
  border: 2px dashed #ddd;
}

.error {
  text-align: center;
  color: #f44336;
  padding: 20px;
  background: #ffebee;
  border-radius: 8px;
  border: 1px solid #ffcdd2;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .zone-info-tabs {
    flex-direction: column;
  }
  
  .tab-btn {
    border-bottom: 1px solid #e0e0e0;
    border-right: none;
  }
  
  .tab-btn.active {
    border-bottom-color: #2196F3;
  }
  
  .products-grid,
  .customers-grid {
    grid-template-columns: 1fr;
  }
  
  .product-details {
    flex-direction: column;
    gap: 4px;
  }
}

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