body {
  font-family: 'Sarabun', sans-serif;
  background-color: #f8fafc;
  /* Tailwind slate-50 */
  color: #1e293b;
  /* Tailwind slate-800 */
}

/* Base App Layout Utilities */
.app-container {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex-grow: 1;
  padding: 1.5rem;
  overflow-x: hidden;
}

@media (min-width: 768px) {
  .main-content {
    padding: 2rem;
    margin-left: 16rem;
    /* 64 = 256px sidebar */
  }
}

/* Cards & Containers */
.glass-card,
.medical-card {
  background: #ffffff;
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  /* slate-200 */
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* Sidebar Styling */
.sidebar-item {
  transition: all 0.2s ease;
  color: #475569;
  /* slate-600 */
}

.sidebar-item:hover {
  background-color: #f1f5f9;
  /* slate-100 */
  color: #0f172a;
  /* slate-900 */
}

.sidebar-item.active {
  background-color: #eff6ff;
  /* blue-50 */
  color: #2563eb;
  /* blue-600 */
  border-right: 3px solid #3b82f6;
  /* blue-500 */
}

/* ===== Standardized Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  /* text-sm */
  font-weight: 500;
  border-radius: 0.5rem;
  /* rounded-lg */
  transition: all 0.2s ease-in-out;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px rgba(59, 130, 246, 0.5);
  /* focus-ring */
}

.btn:disabled,
.btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Semantic Button Styles */
.btn-primary {
  background-color: #2563eb;
  /* blue-600 */
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background-color: #1d4ed8;
  /* blue-700 */
}

.btn-secondary {
  background-color: #ffffff;
  color: #334155;
  /* slate-700 */
  border-color: #cbd5e1;
  /* slate-300 */
}

.btn-secondary:hover:not(:disabled) {
  background-color: #f8fafc;
  border-color: #94a3b8;
}

.btn-success {
  background-color: #16a34a;
  /* green-600 */
  color: #ffffff;
}

.btn-success:hover:not(:disabled) {
  background-color: #15803d;
  /* green-700 */
}

.btn-danger {
  background-color: #dc2626;
  /* red-600 */
  color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
  background-color: #b91c1c;
  /* red-700 */
}

.btn-warning {
  background-color: #eab308;
  /* yellow-500 */
  color: #ffffff;
}

.btn-warning:hover:not(:disabled) {
  background-color: #ca8a04;
  /* yellow-600 */
}


/* ===== Standardized Status Indicators ===== */
.status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  /* text-xs */
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  /* rounded-full */
  white-space: nowrap;
}

.status-success {
  background-color: #dcfce7;
  /* green-100 */
  color: #166534;
  /* green-800 */
}

.status-warning {
  background-color: #fef9c3;
  /* yellow-100 */
  color: #854d0e;
  /* yellow-800 */
}

.status-danger {
  background-color: #fee2e2;
  /* red-100 */
  color: #991b1b;
  /* red-800 */
}

.status-info {
  background-color: #dbeafe;
  /* blue-100 */
  color: #1e40af;
  /* blue-800 */
}

.status-neutral {
  background-color: #f1f5f9;
  /* slate-100 */
  color: #475569;
  /* slate-600 */
}

/* Backward compatibility for old badges just in case */
.badge-green,
.pill-green {
  background-color: #dcfce7;
  color: #166534;
}

.badge-yellow,
.pill-yellow {
  background-color: #fef9c3;
  color: #854d0e;
}

.badge-red,
.pill-red {
  background-color: #fee2e2;
  color: #991b1b;
}

.badge,
.pill,
.chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-weight: 600;
}

/* Forms & Inputs */
.form-input {
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  /* slate-300 */
  border-radius: 0.5rem;
  /* rounded-lg */
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: #1e293b;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-input:disabled {
  background-color: #f1f5f9;
  cursor: not-allowed;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
  /* slate-600 */
  margin-bottom: 0.25rem;
}

/* Custom Table Container for Responsiveness */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-minimal {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  /* text-sm */
  text-align: left;
}

.table-minimal th {
  background-color: #f8fafc;
  color: #64748b;
  /* slate-500 */
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.table-minimal td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

.table-minimal tbody tr:hover {
  background-color: #f8fafc;
}

/* Typeahead/Autocomplete wrapper */
.ac-wrap {
  position: relative;
}

.ac-list {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: 100%;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  max-height: 250px;
  overflow-y: auto;
  margin-top: 0.25rem;
}

.ac-item {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
}

.ac-item:last-child {
  border-bottom: none;
}

.ac-item:hover,
.ac-item.active {
  background: #f1f5f9;
}

/* Loaders */
.loader {
  border: 4px solid #f1f5f9;
  border-top: 4px solid #3b82f6;
  /* blue-500 */
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

.loader-sm {
  width: 24px;
  height: 24px;
  border-width: 3px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  /* slate-900 with opacity */
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.modal-overlay.show {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  background: white;
  border-radius: 1rem;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Utilities */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

.fade-in-up {
  animation: fadeInUp 0.4s ease-out forwards;
}

.danger {
  color: #dc2626;
}

.ok {
  color: #16a34a;
}

.changed {
  background: #eff6ff;
}

/* text-blue-50 instead of cyan */

.lot-row.invalid input,
.lot-row.invalid button {
  border-color: #ef4444;
}

/* Hide scrollbar */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Print Styles */
@media print {
  .no-print {
    display: none !important;
  }

  body {
    background: #ffffff;
    color: #000;
  }

  .main-content {
    margin-left: 0;
    padding: 0;
  }

  .glass-card,
  .medical-card {
    box-shadow: none;
    border: none;
  }

  .btn,
  .status-badge {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}