* {
  box-sizing: border-box;
}

/* ====== BASE ====== */
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f3f4f6;
  color: #111827;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Headings rõ ràng hơn */
h1, h2, h3 {
  margin: 0;
  color: #111827;
  font-weight: 600;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 16px;
}

/* ====== LAYOUT ====== */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: linear-gradient(180deg, #020617, #111827);
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 16px 20px;
  font-size: 18px;
  font-weight: 700;
  border-bottom: 1px solid #1f2937;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
}

.sidebar-nav a {
  display: block;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 14px;
  margin-bottom: 4px;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.sidebar-nav a.active {
  background: #f9fafb;
  color: #020617;
  font-weight: 600;
}

.sidebar-nav a:hover:not(.active) {
  background: #111827;
  transform: translateX(2px);
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid #1f2937;
  font-size: 13px;
  color: #9ca3af;
}

.main {
  flex: 1;
  padding: 20px;
  animation: mainFade 0.25s ease-out;
}

@keyframes mainFade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ====== CARD / PANEL ====== */
.card {
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid #e5e7eb;
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: 0 10px 15px -10px rgba(15, 23, 42, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 30px -18px rgba(15, 23, 42, 0.35);
}

/* ====== BUTTON ====== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  background: #020617;
  color: #f9fafb;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s ease, color 0.12s ease,
              transform 0.1s ease, box-shadow 0.1s ease;
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.filter-actions .btn {
  min-width: 90px;
}

.btn.secondary {
  background: #e5e7eb;
  color: #111827;
}

.btn.sm {
  padding: 5px 9px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.25);
}

.btn.secondary:hover:not(:disabled) {
  background: #d1d5db;
}

/* ====== FORM ====== */
.input,
select,
textarea {
  width: 100%;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
  background-color: #ffffff;
}

.input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #1d4ed8;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2);
}

label {
  font-size: 13px;
  color: #374151;
  font-weight: 500;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-col {
  flex: 1;
}

/* ====== TABLE ====== */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  padding: 8px 10px;
  border-top: 1px solid #e5e7eb;
}

.table th {
  background: #f3f4f6;
  text-align: left;
  font-weight: 600;
  color: #374151;
}

.table tbody tr:hover {
  background: #f9fafb;
}

/* ====== SUMMARY TEXT ====== */
.total-contract-amount {
  margin-top: 16px;
  font-size: 16px;
  font-weight: 500;
  color: #111827;
}

.total-contract-amount span {
  font-size: 20px;
  font-weight: 700;
  color: #dc2626; /* Đỏ */
}

.total-commission {
  margin-top: 16px;
  font-size: 16px;
  font-weight: 500;
  color: #111827;
}

.total-commission span {
  font-size: 20px;
  font-weight: 700;
  color: #dc2626; /* đỏ */
}
.btn.primary {
  background: linear-gradient(90deg, #2563eb, #4f46e5);
}

.btn.primary:hover {
  background: linear-gradient(90deg, #1d4ed8, #4338ca);
}

/* ====== CHART WRAPPER ====== */
.chart-card {
  flex: 1;
  min-height: 260px;
}

.chart-wrapper {
  position: relative;
  height: 220px;  /* chiều cao cố định của biểu đồ */
  width: 100%;
}

/* ====== BADGE / TEXT ====== */
.badge {
  display: inline-block;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e5e7eb;
}

.badge.green {
  background: #dcfce7;
  color: #166534;
}

.badge.red {
  background: #fee2e2;
  color: #991b1b;
}

.badge.blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.text-sm {
  font-size: 13px;
}

.text-xs {
  font-size: 11px;
  color: #6b7280;
}

.mt-2 {
  margin-top: 8px;
}

.mt-3 {
  margin-top: 12px;
}

.mt-4 {
  margin-top: 16px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-3 {
  margin-bottom: 12px;
}

.mb-4 {
  margin-bottom: 16px;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 8px;
}

.w-full {
  width: 100%;
}

.text-right {
  text-align: right;
}

.text-danger {
  color: #b91c1c;
}

.text-muted {
  color: #6b7280;
}

/* ====== ROLE BADGE (nếu dùng) ====== */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: #e5e7eb;
  color: #374151;
  font-weight: 500;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
  }

  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
  }

  .sidebar-footer {
    display: none;
  }

  .form-row {
    flex-direction: column;
  }
}
