:root {
  --bg-color: #f4f7f9;
  --widget-bg: #ffffff;
  --text-color: #333;
  --primary-color: #007bff;
  --border-color: #e0e0e0;
  --shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}
body {
  font-family: 'Sarabun', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
}
header {
  background-color: var(--widget-bg);
  padding: 1rem 2rem;
  box-shadow: var(--shadow);
  border-bottom: 1px solid var(--border-color);
}
#dashboard-title {
  margin: 0;
  font-size: 1.8rem;
}
#dashboard-container {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
  padding: 24px;
}
.widget {
  background: var(--widget-bg);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
  grid-column-end: span 12;
  /* Default to full width */
  display: flex;
  flex-direction: column;
}
.widget-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}
.widget-content {
  flex-grow: 1;
  position: relative;
}
.widget-content .loading,
.widget-content .error {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: #888;
}
/* Card Widget */
.card-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
}
.card-value {
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary-color);
}
.card-label {
  font-size: 1.1rem;
  color: #666;
}
/* Table Widget */
.table-wrapper {
  overflow-x: auto;
  max-height: 400px;
  /* or any height */
}
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}
thead th {
  background-color: #f8f9fa;
  font-weight: 700;
}
tbody tr:hover {
  background-color: #f1f1f1;
}
/* Conditional Formatting */
.row-success {
  background-color: #d4edda !important;
}
.row-warning {
  background-color: #fff3cd !important;
}
.row-info {
  background-color: #d1ecf1 !important;
}
.row-danger {
  background-color: #f8d7da !important;
}
/* Pagination */
.pagination-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 15px;
  font-size: 0.9em;
}
.pagination-controls button {
  padding: 5px 10px;
  border: 1px solid var(--border-color);
  background-color: #fff;
  cursor: pointer;
  border-radius: 4px;
}
.pagination-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
/* Responsive */
@media (max-width: 768px) {
  .widget {
    grid-column-end: span 12 !important;
    /* Stack on mobile */
  }
}