/* =====================================================
   Style 6 — Card Grid Đơn Vị  |  NQ57 Dashboard
   Design System: Vibrant Block
   ===================================================== */

/* ---------- Base ---------- */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #F9FAFB;
  color: #111827;
  min-height: 100vh;
}

/* ---------- Sticky Header ---------- */
.g6-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #FFFFFF;
  border-bottom: 1px solid #E5E7EB;
  padding: 16px 20px 12px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

.g6-header-top {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.g6-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  flex: 1;
  white-space: nowrap;
}

.g6-search {
  padding: 8px 14px;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  width: 220px;
  outline: none;
  transition: border-color 200ms ease, box-shadow 200ms ease;
  background: #F9FAFB;
}
.g6-search:focus {
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
  background: #fff;
}

/* ---------- Filter Chips ---------- */
.g6-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.g6-chip {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1.5px solid #E5E7EB;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  color: #374151;
  transition: all 200ms ease;
  white-space: nowrap;
}
.g6-chip:hover {
  border-color: #2563EB;
  color: #2563EB;
}
.g6-chip.active {
  background: #2563EB;
  border-color: #2563EB;
  color: #fff;
}

/* ---------- Sort Row ---------- */
.g6-sort-row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.g6-sort-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.g6-sort-label {
  font-size: 13px;
  font-weight: 500;
  color: #6B7280;
  white-space: nowrap;
}

.g6-sort-select {
  padding: 5px 10px;
  border: 1.5px solid #D1D5DB;
  border-radius: 6px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  color: #374151;
  background: #fff;
  cursor: pointer;
  outline: none;
  transition: border-color 200ms ease;
}
.g6-sort-select:focus {
  border-color: #2563EB;
}

/* ---------- Stats Bar ---------- */
.g6-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-left: auto;
}

.g6-stat-item {
  font-size: 13px;
  color: #6B7280;
  white-space: nowrap;
}
.g6-stat-item strong {
  color: #111827;
  font-weight: 600;
}

.g6-stat-sep {
  color: #D1D5DB;
  font-size: 13px;
}

/* ---------- Grid ---------- */
.g6-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 24px 20px;
  max-width: 1400px;
  margin: 0 auto;
}
@media (max-width: 1024px) {
  .g6-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .g6-grid { grid-template-columns: 1fr; padding: 16px 12px; }
  .g6-search { width: 160px; }
  .g6-stats { margin-left: 0; }
}

/* ---------- Card ---------- */
.g6-card {
  background: #FFFFFF;
  border: 2px solid #E5E7EB;
  border-radius: 12px;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
  cursor: pointer;
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
  position: relative;
}
.g6-card:hover {
  border-color: #2563EB;
  box-shadow: 0 4px 20px rgba(37,99,235,0.15);
  transform: translateY(-4px);
}

/* ---------- Card Top Row ---------- */
.g6-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

/* ---------- Badge ---------- */
.g6-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: 0.02em;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Status Dot ---------- */
.g6-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---------- Donut Container ---------- */
.g6-donut {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 14px;
}

/* ---------- Card Name ---------- */
.g6-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  line-height: 1.35;
  margin-bottom: 12px;
  min-height: 40px;
}

/* ---------- Stats ---------- */
.g6-card-stats {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: #F9FAFB;
  border-radius: 8px;
}

.g6-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.g6-label {
  font-size: 12px;
  color: #9CA3AF;
  font-weight: 500;
  white-space: nowrap;
}

.g6-val {
  font-size: 12px;
  color: #374151;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ---------- Card Footer ---------- */
.g6-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 4px;
}

.g6-nv-count {
  font-size: 12px;
  color: #6B7280;
  font-weight: 500;
}

.g6-detail-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1.5px solid #2563EB;
  background: none;
  color: #2563EB;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 200ms ease, color 200ms ease;
}
.g6-detail-btn:hover {
  background: #2563EB;
  color: #fff;
}

/* ---------- Empty State ---------- */
.g6-empty {
  max-width: 400px;
  margin: 80px auto;
  text-align: center;
  padding: 32px;
}
.g6-empty svg {
  margin-bottom: 16px;
  opacity: 0.5;
}
.g6-empty p {
  font-size: 15px;
  color: #6B7280;
  margin-bottom: 16px;
  font-family: 'Space Grotesk', sans-serif;
}
.g6-reset-btn {
  padding: 8px 20px;
  border-radius: 8px;
  border: 1.5px solid #2563EB;
  background: none;
  color: #2563EB;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 200ms ease, color 200ms ease;
}
.g6-reset-btn:hover {
  background: #2563EB;
  color: #fff;
}

/* ---------- Modal Content ---------- */
.modal-box {
  position: relative;
}

.g6-modal-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid #E5E7EB;
}

.g6-modal-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 12px;
  padding-right: 32px;
  line-height: 1.3;
}

.g6-modal-summary {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.g6-modal-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.g6-modal-stat .lbl {
  font-size: 11px;
  color: #9CA3AF;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.g6-modal-stat .val {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  font-variant-numeric: tabular-nums;
}

.g6-modal-search-row {
  margin-bottom: 14px;
}
.g6-modal-search {
  width: 100%;
  padding: 8px 14px;
  border: 1.5px solid #D1D5DB;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 200ms ease;
}
.g6-modal-search:focus {
  border-color: #2563EB;
}

.g6-modal-table-wrap {
  overflow-x: auto;
}

.g6-modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.g6-modal-table th {
  text-align: left;
  padding: 9px 12px;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  color: #6B7280;
  border-bottom: 2px solid #E5E7EB;
  white-space: nowrap;
  background: #F9FAFB;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.g6-modal-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #F3F4F6;
  vertical-align: top;
  color: #374151;
}
.g6-modal-table tr:hover td {
  background: #F9FAFB;
}
.g6-modal-table .td-num {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.g6-modal-table .td-center {
  text-align: center;
}
.g6-modal-table .td-stt {
  color: #9CA3AF;
  font-size: 12px;
  width: 32px;
}

.g6-modal-empty {
  padding: 32px;
  text-align: center;
  color: #9CA3AF;
  font-size: 14px;
}

/* ---------- Tình trạng Badge ---------- */
.g6-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.g6-status-badge.chua_bc { background: #F3F4F6; color: #6B7280; }
.g6-status-badge.thap    { background: #FEE2E2; color: #B91C1C; }
.g6-status-badge.trung_binh { background: #FEF3C7; color: #B45309; }
.g6-status-badge.tot     { background: #D1FAE5; color: #065F46; }

/* ---------- Pct color classes ---------- */
.pct-none  { color: #6B7280; }
.pct-thap  { color: #EF4444; }
.pct-mid   { color: #F59E0B; }
.pct-tot   { color: #22C55E; }

/* ---------- Loading ---------- */
.g6-loading {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 16px;
  color: #9CA3AF;
  font-size: 14px;
}
